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

HTML Build an Interactive Website Introduction to jQuery Using jQuery to Select Elements

Introduction to jQuery code challenge

In the build an interactive website course on the second step of the challenge, the task is to select all the list elements (li) inside an unordered list (ul) with the class of '.nav'

I used this code and it didn't work

$( ".nav li" );

I have also tried a few other css selector methods and I still couldn't pass the challenge.

Could somebody please help explain why I am not passing the challenge? Thanks in advance

3 Answers

$("ul.nav li")

Just a little more specific

Ethan Lowry
PLUS
Ethan Lowry
Courses Plus Student 7,323 Points

While what you have posted is valid CSS that will in fact select all list elements inside any element with a class of 'nav', it may be that the challenge wants you to specifically include the unordered list in your selector. Try what you have, but with the 'ul' element (with the nav class attached) added.

Thank you so much! I was confused because I thought I was calling on the right class. I wasn't specific enough