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 trialMUZ140877 Nokuthula Mahlangu
6,149 PointsTake a look around the html and js files. Line 5 of app.js is incorrect. listItems should be the children of the naviga
really confused here
1 Answer
Iain Simmons
Treehouse Moderator 32,305 PointsLines 1 through 5 of app.js
currently have the following code:
//Select the navigation
var navigation = document.getElementById("navigation");
//Select all listItems from the navigation
var listItems = navigation;
If you look at index.html
, it has an unordered list (ul
tag) with the id
of navigation
. So the navigation
variable will refer to the ul
element.
listItems
is currently just referencing the navigation
variable, so it will just be assigned the same ul
element, when it should be referencing the li
elements that are child elements of the ul
.
So you need to use the children property to access the child elements. In this case, you want the children
of navigation
.
I'll leave it to you to figure out what to write on line 5. :)