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


Help With Challenge

Can anyone help with this challenge:


Hey Douglas,

So on Task 1 of 1 :

// This gets the element with the "navigation" id from index.html and stores it inside a variable called "navigation"
var navigation = document.getElementById("navigation");   

// This gets the children (the <li> items) of that same navigation element and stores it another var
var listItems = navigation.children;

For Task 2 of 2 :

HINT : You need to use the querySelector() method. Here is an example :

element = baseElement.querySelector(selectors);

2 Answers

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Think about what the question is asking for.

It's talking about traversing which is moving between different elements in the document tree which is HTML tags in the DOM.

You want to be able to search for the children of an unordered list which is your listItems variable.

So turn this

var listItems = navigation;

into this

var listItems = navigation.children;
Sean T. Unwin
Sean T. Unwin
28,690 Points

To further illustrate this, it is discussed two videos prior to the challenge in question, starting at about 6:45 of the lesson on Traversing Elements with Children.

thanks to all for the great answers, sometimes it's hard to understand what the instructor is trying to teach me.......i only saw one option for best answer so i clicked it.