< div id = "test" >< div > Test </ div >Hello World!< b > Hello </ b >New Test!</ div >
$ ( '#test' )// Get textNode contents only. contents ( function ( ) {if ( this . nodeType === 3 ) {// Add to collection when return truereturn true ;}} )// For each textNodes, change value. each ( function ( ) {this . nodeValue = 'Changed!' ;} ) ;
< div id = "test" >< div > Test </ div >Changed!< b > Hello </ b >Changed!</ div >