html - How can I select all the empty tag using jQuery.? -


this question has answer here:

how can select empty tag using jquery.

i want select

<p></p> <p style="display: block"></p> <p> </p> <p>     </p> <p>&nbsp;</p> 

and not

<p>0</p> <p>test</p> 

i tried :empty not working options. on appreciated.

you can using jquery.filter().

var empty_p = $('p').filter(function(){    return !$.trim($(this).text()); }).get(); 

Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

java - activate/deactivate sonar maven plugin by profile? -

java - What is the difference between String. and String.this. ? -