Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Using jQuery to Select Elements - Task 2

In the code challenge "On the next line, use jQuery to select all list items (li) in an unordered list (ul) with the class of 'nav'?" I don't know which is the right answer.

I though the right answer was $("nav ul li a");

Thanks

5 Answers

$(".nav li"); or $("ul.nav li") should do the trick.

thanks, now it works

Just remember the rules are similar to that of css so when it asks you to select "with the class of 'nav' " you will be using the '.' to select the class.

I just posted this a few days ago. I got a bit confused too.

Which challenge would that be? Could you please provide a link?