Treehouse jQuery Task

How to use jQuery to select list items from an unordered list that has a specific class? The exact question is: "On the next line, use jQuery to select all the list items (li) in the unordered list (ul) with the class" nav "?

I tried several times at Treehouse, but that will not let me get through!

$(".nav ul li"); 
+6
source share
2 answers

Your $(".nav ul li") selector means some element with class nav has ul , if ul has class nav then try this .

 $("ul.nav li"); 
+12
source
 $('.nav').children('li') 

will be a faster way to do this.

+1
source

All Articles