I have a list which is dynamically built, but there are empty list items which need removing.
<ul>
<li>www</li>
<li>www</li>
<li>www</li>
<li></li>
<li></li>
<li></li>
</ul>
How od i do this with jquery? Thanks
I have a list which is dynamically built, but there are empty list items which need removing.
<ul>
<li>www</li>
<li>www</li>
<li>www</li>
<li></li>
<li></li>
<li></li>
</ul>
How od i do this with jquery? Thanks
$('ul li').filter(function() {return $(this).text() == '';}).remove();
$('ul').find('li').each(function(){
if($(this).is(':empty'))
$(this).remove();
});
Please use Andy's implementation (above mine :))