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

JavaScript CSS Selectors Quickstart The Role of Selectors in JavaScript Selectors in JavaScript Review

selectors in js

Please fill in the correct answer in each blank provided below.

Fill in the blank(s) below:
Consider the following HTML:

<nav> <ul> <li><a href="index.html">Portfolio</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav>

Complete the JavaScript code below by writing a selector that targets all <a> elements inside the <nav> element:

var expectedLinks = document.querySelectorAll("");

Steven Parker
Steven Parker
231,236 Points

So what answer are you putting into the blank?

Yes what to put In the blank

Steven Parker
Steven Parker
231,236 Points

I'm asking you: what answer did you try that did not work?

If you don't have any idea of what to put, you might want to review the video.

there aren't any videos for this section there were these reading things i reviewed them but am still confused i put var expectedLinks = document.querySelectorAll("a");

1 Answer

Tobias Graefe
Tobias Graefe
11,934 Points

Try to make it more specific. It is asked for all anchor elements, that are nested in the nav element. So it should be the descendant selector "nav a".