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

Scott Becker
Scott Becker
20,349 Points

The JQuery Task 2 goes over a string not discussed in the video?

.nav ul li?

3 Answers

Think of it as if you're describing the element. You want to first select the unordered list with the class of nav and then select the list items in it.

So it would be $("ul.nav li"); without spaces between the element and its class or id. I honestly don't know why this is the way it is. But it's the only way it worked for me.

Hope this helps.

Scott Becker
Scott Becker
20,349 Points

Thanks, Ali (and Errin)... that makes sense.

Also, remember that jQuery uses the same CSS specifications. So you would use the $(""); then input css rules and specifications if thats what the questions is calling for. "string" is used when you select a selector to write code in jQuery. You have to use the dollar sign, parentheses, quotes, and a semi-colon. $(""); to write jQuery.

http://api.jquery.com/category/selectors/attribute-selectors/