The platform I\'m building a website on produces empty p tags in wysiwyg mode. How can I take these out?
Something like this, perhaps...
$
I'm a little late to the party, but I found this thread recently as I was looking to solve this issue as well.
I came up with a Vanilla JS solution here, which worked for me:
var p = document.querySelectorAll('p:empty');
for(var i = p.length - 1; i > -1; i-- ) {
p[i].parentNode.removeChild(p[i]);
}
It basically does (exactly) what fireeyedboy suggested, but without jQuery.
It also appears to perform better than jQuery as well: http://jsperf.com/remove-empty-elements-javascript-vs-jquery
Hope this helps!