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 trialNatanon Bay
5,218 PointsI keep getting 5 links not 3
I am getting 5 links instead of 3 no idea why and i get lost trying to figure out whats going on in the index.html. I feel like the solution is very simple but i cant get it HELP!
3 Answers
Steven Parker
231,248 PointsGlad I could help. Happy coding!
Steven Parker
231,248 PointsI can't be specific without seeing your code, but most likely your selector is not specific enough. The challenge asks for "all links in the nav element", so depending on what method you use, you'll need chained methods or a descendant selector.
Natanon Bay
5,218 Pointsfirst I tried let navigationLinks = document.querySelectorAll('li'); but realized there were 2 extra so i tried let navigationLinks = document.querySelectorAll('nav'); hoping it would select all the links in the nav element but i only got 1 link. I also tried let navigationLinks = document.getElementsByTagName('nav');
Steven Parker
231,248 PointsBut "li" is a list item, and "nav" by itself would only target the nav
element itself.
A "link" is represented by an "a" element. So to get all the links inside the nav
you could use a descendant selector: "nav a".
Natanon Bay
5,218 PointsOkay thank you so much i got it!
Steven Parker
231,248 PointsSteven Parker
231,248 PointsPlease show your code to make it possible to identify the issue.