Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

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() ?  
0
jeremyll
Asked:
jeremyll
  • 2
1 Solution
 
ansudhindraCommented:
your code is working..
I dont see any bugs and is doing what it has to do..

BR-Sudhindra-www.clicksperday.com
0
 
leakim971PluritechnicianCommented:
please provide the html
0
 
ansudhindraCommented:
here is the working one..

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

Please post the complete code (html)...

BR- Sudhindra-www.clicksperday.com
0
 
ProculopsisCommented:

// Not quite what you what but try this instead:

$(this).css( {display: "none"} );
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now