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

CSS

Introduction to jQuery challenge bug

I have a problem with the "Code Challenge: Using jQuery to Select Elements" in "Introduction to jQuery". I can't pass the second part of the challenge even though I think my code is correct.

The instruction is "On the next line, use jQuery to select all list items (li) in an unordered list (ul) with the class of 'nav'?". My code, including line from the previous part looks like this:

$('#container');
$('.nav li');

I've tried many other combinations but none of them worked .

Can anyone tell me if it is really a bug or am I doing something wrong?

Thanks..

7 Answers

Here's a hint

The HTML would look something like this:

<ul class="nav">
  <li></li>
</ul>

Remember: In this challenge you need to be as specific as possible.

Martin - Check out this tutorial on using type & class selectors together.

If you are still having issues, post what code you have so far, in your own thread and we'll try to get you straightened out.


Mod Note: Remember the rule of thumb your issue, your code, your thread

Used the proper selector and it worked just fine. Thanks!

What is the proper selector in this situation? I went back through the various selector sections on the various css videos, and couldn't find it. I'm ready to just learn what it is, so I can move on.

Thanks, the tutorial was helpful. I'll keep the mod note in mind next time.

I need the answer too and I don't know how to start my own thread

Hi Amanda, the solution to the problem is the following:

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

It means that all li elements within a ul with a class="nav" that James said will be selected.