Another way to do this is using regular expressions instead of trim() :
$('p').filter(function () { return !/\S/.test( $(this).text() ); })
( JSFiddle )
Note that this (and any other solution based on $(this).text() ) will also match, for example. this item:
<p><a href="http://example.com"> </a></p>
or even:
<p><img src="http://example.com/image.gif"></p>
Depending on what you want to do with the paragraphs, this may or may not be what you want. If this is not the case, you will need something more complex; the details will depend only on what exactly you would like to consider the "blank" paragraph.
source share