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 trialMathew Gries
7,072 PointsHow to you select children elements of parents?
In the JavaScript and the DOM course, the last challenge first asks you to select all li elements in the nav element. I have tried various methods and none of them are coming back successful.
document.querySelector('nav').querySelectorAll('li') document.getElementsByTagName('nav')[0].querySelectorAll('li') document.querySelectorAll('nav ul li') document.querySelectorAll('nav li')
Each error basically states I am grabbing the wrong li elements. The course does not go over accessing children elements, so I am confused as to why this is in a challenge if the material was not reviewed?
1 Answer
KRIS NIKOLAISEN
54,971 PointsThe challenge asks you to select links which have a tag of <a>. List items have a tag of <li>.
Mathew Gries
7,072 PointsMathew Gries
7,072 PointsYeah, I can't believe I missed that. Thanks!