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

General Discussion

About code challenge

Try to add nav class and selector ul li .

I dont know what im doing wrong. Watched video couple times, but cant get this right. Please help.

6 Answers

James Barnett
James Barnett
39,199 Points

The key to this question is to understand that the <ul> element has a class of nav, in other words it's <ul class = "nav">.

So the HTML would look something like this:

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

Now ask yourself ... what is the CSS selector I would use to select all <li>s from the above markup?

If you are unclear on how to do that, consider checking out the Learn HTML & CSS learning adventure.

ul li .nav It would be all li selected with in ul with class nav. But It is a code on Jquery. $("ul li").addClass("nav");

James Barnett
James Barnett
39,199 Points

What's the link to the code challenge you are having issues with?

James Barnett
James Barnett
39,199 Points

For reference the instructions are:

On the next line, use jQuery to select all list items (li) in an unordered list (ul) with the class of 'nav'?

Note the directions, make no reference to adding a class with JQuery, but instead referencing a class with CSS.

So giving this HTML:

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

Hint: Use the most specific CSS selector.

Thank you finally I got it