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
Using jQuery to Select Elements/ Second Challenge
use jQuery to select all list items (li) in an unordered list (ul) with the class of 'nav'?
I've been spending a while on this question and I can't seem to get it right. I thought it was the code below, but I seem to be mistaken. Any suggestions?
$("ul li.nav");
7 Answers
David Poindexter
Courses Plus Student 1,690 PointsTry this:
$("ul > li.nav");
There was a discussion about this when the forum was on the facebook page, but I can't seem to find it.
you are close, the question is stating that the ul has a class of nav so you would need to do $("ul.nav li");
David Poindexter
Courses Plus Student 1,690 PointsWell that's kind of an ambiguously-worded question then :)
Andrew Chalkley
Treehouse Guest TeacherI promise I wasn't trying to cause confusion :)
David Poindexter
Courses Plus Student 1,690 PointsNo worries. I actually can't think of a much better way to word it either!
Regardless, the question and the answer are now here, hopefully searchable, for any future travelers :)
Perfect, thanks!
Art Marin
Courses Plus Student 4,466 Pointsthanks, i was stock on this for awhile also .. :)