How can one use jQuery to select list items from an unordered list that has a specific class? The exact question reads "On the next line, use jQuery to select all list items (li) in an unordered list (ul) with the class of 'nav'?"
I have tried several times on treehouse but it won't let me pass!
$(".nav ul li");
Your selector $(".nav ul li")
means some element with class nav has ul
, if ul has class nav then try this
.
$("ul.nav li");
$('.nav').children('li')
would be a faster way to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With