Link to home
Start Free TrialLog in
Avatar of jeremyll
jeremyll

asked on

Jquery - .remove() bug

I'm trying to remove empty UL tags using Jquery below:

$("ul").each(function(){
     if ($(this).find("li").length == 0) {
     $(this).remove();
     // $(this).css("border","20px solid red");
     }
});

The strange thing is the $(this).remove(); doesn't work, whereas $(this).css("border","20px solid red"); in the code above works!

Are there any known bugs with .remove() ?  
Avatar of Sudhindra A N
Sudhindra A N
Flag of India image

your code is working..
I dont see any bugs and is doing what it has to do..

BR-Sudhindra-www.clicksperday.com
Avatar of leakim971
please provide the html
here is the working one..

http://jsfiddle.net/Sudhindra/6hybe/

Please post the complete code (html)...

BR- Sudhindra-www.clicksperday.com
ASKER CERTIFIED SOLUTION
Avatar of Proculopsis
Proculopsis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial