jQuery - remove element if empty content by Norlihazmey Ghazali
jQuery - remove element if empty content by Norlihazmey Ghazali http://stackoverflow.com/questions/32448055/jquery-check-empty-element-and-remove/32448078#32448078
HTML
<p>1</p>
<p>2</p>
<p></p>
<p>1</p>
<p></p>
JavaScript
$('p').filter(function () {
return ($(this).text() == "")
}).remove();
$('p').each(function (i, e) {
if ($(e).text() === "") $(e).remove();
});
$('p:empty').remove();