Hide empty <li>
问题 I want to hide all the <li> if they are empty or if there any blank space in <li> . I am doing it like this: $("li:empty").filter(function(i,v){return $.trim($(v).text()).length == 0;}).css('display', 'none'); Is this the wrong syntax? If I create a class to make empty <li> invisible, it works fine. Like this: $("li[class='hideLi']").filter(function(i,v){return $.trim($(v).text()).length == 0;}).css('display', 'none'); But I don't know which <li> will be empty . Can anybody help me plz. I