What's wrong with this? I'm trying to hide all empty li.
$(document).ready(function() {
$("#details li").each(function() {
if ($(this).length == 0) {
$(this).css({ display: "none" }); ;
}
});
});
Markup:
<ul id="details">
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
<li></li>
<li></li>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
<li>Lorem Ipsum</li>
</ul>
Thank you in advance