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

JQuery selecting CSS

On the first challenge task I don't know what I'm doing wrong. To select the list items in the unordered list in the nav class I typed $(".nav ul li"); but it doesn't work. What am I missing?

10 Answers

Scott Evans
Scott Evans
4,236 Points

That's really strange my code is exactly the same, have you tried reloading the challenge and restarting it. Try retyping the code aswell

Scott Evans
Scott Evans
4,236 Points

Hi Liam,

That is strange, there isn't a reason why that shouldn't work., could you tell me what error the Treehouse code editor is giving you when you try and check the work?

Thanks, Scott.

It says: Bummer! Enter the string of the CSS selector for all li elements in a ul element with the class of 'nav'

Scott Evans
Scott Evans
4,236 Points

That is very strange o_O. Could i see your code also?

No problem, how you I share the code with you? Not done it before!

Scott Evans
Scott Evans
4,236 Points

Just post it in this discussion

$("#container"); $(".nav ul li");

Those are on separate lines by the way.

Yeah tried refreshing and even logging out and back in again. I'm really confused.

David Rynn
David Rynn
10,554 Points

Someone else answered this...

https://teamtreehouse.com/forum/on-the-next-line-use-jquery-to-select-all-list-items-li-in-an-unordered-list-ul-with-the-class-of-nav-2

$(ul.nav li)

It's selecting all the 'li' within the <ul class='nav> so that's why the syntax is different, as opposed to <div class='nav'> <ul> <li> </li> </ul> </div> which would be your (and my) earlier attempt of $(.nav ul li)