Jquery html attribute : How to exclude an element's child's html from that element's html?

Up vote 0 down vote favorite share g+ share fb share tw.

Jquery html filter selector link|improve this question asked Nov 9 '09 at 23:10Patrice Paquette11.

$('#some_text:first-child').html(); //contains your text $('#some_text:first-child').remove(); //to remove.

Use replaceWith(): $("#some_text > p"). ReplaceWith("some other html"); or if you need to be more specific: $("#some_text > p:first-child"). ReplaceWith("some other html"); or even use not(): $("#some_text").children().

Not("#child"). ReplaceWith("some other html"); replaceWith() will replace each matched element with the specific HTML so if you match more than one you'll get duplicate content. An alternative is to remove it then add the HTML you want.

Basically replacing the HTML inside the div while maintaining the child element is hard because where do you put the new HTML? Before it? After?

Around? You probably need to be more specific about that.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions