jquery - Exchange h3 header text with some other text -


i've got header other elements inside. e.g.:

<h3 id="header" > <span ...></span> title <img ...> </h3> 

i want replace "title" other text. thats tried:

$("#header").contents().filter(function(){return this.nodetype == 3;}).text("some other text"); 

but nothing happens here...

you can do:

$('#header').contents().filter(function () {     return this.nodetype === 3 && $.trim(this.nodevalue).length; }).replacewith('some other text'); 

fiddle demo


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -