It's not saying what you want, instead it's saying : - $("li") get all li - .not(":has(ul)") keep only those that don't contain any ul
You might prefer something on the lines of : $("li").not("ul li") Which says : - $("li") get all li - .not("ul li") don't keep those that have ul for ancestor Michel Belleville 2009/11/6 karlkras <karlk...@gmail.com> > Hey, > So I'm using the starterkit to go through the basics with jQuery and > had a question on the expected behavior of this function: > $(document).ready(function() { > $("li").not(":has(ul)").css("border", "1px solid black"); > }); > > Isn't this saying: > Select all <li> elements, if the li element is not contained in an > <ul> then apply the style. > If so, then this doesn't appear to be working properly in the > starterkit.html > e.g., if I add this to the page: > > <ul id="bulletlist"> > <li>First element</li> > <li>Second element</li> > <li>Third element</li> > </ul> > > wouldn't the .not be applied to ul and therefore in this case the > style shouldn't be applied? This isn't what I'm seeing. > > thanks, > K >