Is there a way to remove text that is not wrapped in any tag using jQuery
This is some text
This is \"unwrapped\" text //to be removed
&
It's amazing but at the same time the following code doesn't work
$("div.myClass:has(img)").contents().filter(":text").remove();
and the code from the first post works
$("div.myClass:has(img)")
.contents()
.filter(function() {
return this.nodeType == 3; //Node.TEXT_NODE
}).remove();
It's important to remeber! jQuery 1.8.3.
And first of all I remember that innerHTML manipulation works much more faster than this approach!