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 trialTim Brooks
2,339 PointsDOM > Selecting Elements - Can't get child elements selected right
I'm stuck on this code challenge. I've got step 1 covered, but step 2 seems like it should be working but it isn't. For:
Next, select all links inside the unordered list with the ID gallery and assign them to the variable galleryLinks.
I coded:
let navigationLinks; let galleryLinks; let footerImages;
navigationLinks = document.querySelectorAll("nav li a"); galleryLinks = document.querySelectorAll("gallery ul a");
1 Answer
Gerard Vlam
9,665 Pointslet navigationLinks = document.querySelectorAll("nav li a"); let galleryLinks = document.querySelectorAll("#gallery ul a"); let footerImages = document.querySelectorAll("footer a img");
Use the # to select an element by ID.
Mark Reijgwart
Full Stack JavaScript Techdegree Student 8,062 PointsMark Reijgwart
Full Stack JavaScript Techdegree Student 8,062 PointsCould you provide us with the HTML?