Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

abdul faiz mohd jayramie eng
Courses Plus Student 4,478 PointsExtremely noob question on Jquery Challange, help needed
hey im new around here, regestered yesterday.
Im currently doiung "Code Challenge: Using jQuery to Select Elements" i understand partial of CSS advance slectors, unfortunately i couldn't answer this final question, where it says:
"On the next line, use jQuery to select all list items (li) in an unordered list (ul) with the class of 'nav'?"
shoudn't it be $(".nav ul li"); OR without the (dot) $("nav ul li");
i dont get it, what was my mistake?
5 Answers

Randy Hoyt
Treehouse Guest TeacherIt does need the dot because "nav" is a class. The selector as you have written it -- $(".nav ul li") -- would find an li in the following structure:
<div class="nav">
<ul>
<li>I'm a list item!</li>
</ul>
</div>
The question is actually asking you to find an li in this structure:
<ul class="nav">
<li>I'm a list item!</li>
</ul>
Does that help?

James Barnett
39,199 Points@abdul Have you been through the CSS Foundations
course on Treehouse yet? All of the selectors used in JQuery are the same as the ones from CSS.
The CSS Selectors badge is a great place to start.

rayorke
27,709 PointsWithout a spoiler:
Think of it this way - what element is the class assigned to?
" On the next line, use jQuery to select all list items (li) in an unordered list (ul) with the class of 'nav'? "
*Whoops, Randy beat me to it.

abdul faiz mohd jayramie eng
Courses Plus Student 4,478 Pointsthanks guys for the advice! Randy got it right, finally got through it. many thanks!

Andrew Chalkley
Treehouse Guest TeacherThanks for helping Abdul all!
Best of luck with the rest of your learning.