I have an <ul>
that if the child img is missing from the <li>
it needs to be removed. I am using jQuery 1.4.2.
I used:
$("#itemList ul li").filter(function() {
return $(this).children("img").length == 0;
}).remove();
This worked fine Firefox, did not throw any errors. All other major browsers threw an error. Using the following did not produce an error:
$("#slider ul li").each(function(index) {
if ($(this).children("img").length == 0)
{
$(this).remove();
}
});
Is this a bug in jQuery or is there something fundamental missing from my first line of code?