Hoping someone can help. I need to grab any text node inside the body. Even if it is NOT contained within any other element.
I've tried:
$("p, div, html, body").each(function(){
$(this).contents().filter(function() {
var regExText = /(\w|\d|,|;|&)/;
if (this.nodeType == 3 && regExText.test(this.nodeValue)) {
$(this).wrap('<span></span>');
}
});
});
This is grabbing them in the Ps and Divs but not in the body itself.