I found How do I select text nodes with jQuery? but my problem is that although I can go like
$(elem)
.contents()
.filter(function() {
return this.nodeType == Node.TEXT_NODE;
}).each(function() {
this.nodeValue = //stuff
});
I am trying to figure out how I can combine this.nodeType
with the before
and after
nodes because some of the stuff I need can appear as a combination of the this.nodeValue + before
, this.nodeValue
or this.nodeValue + after
if that makes sense and I need to test EACH node value as well as it in combination with the previous and next ?