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 trialluisgomez7
5,557 PointsReturning Elements Using CSS Selectors
Once again I'm stumped; this time on the third objective in the above link. I keep getting error messages no matter what approach I use.
Here's the objective:
"Next, select all <a> elements inside the unordered list with the ID gallery and assign them to the variable galleryLinks."
This is my answer:
let footerImages = document.querySeletorAll('footer a');
Here's the error message:
"There was an error with your code: TypeError: 'undefined' is not a function (evaluating 'document.querySeletorAll('footer a')')"
What am I doing wrong?
2 Answers
Steven Parker
231,261 PointsYea, that error message isn't too helpful. And you were right that the target part of your descendent selector should be "a". But the function name should be spelled "querySelectorAll" (with a "c").
And for the container part "the unordered list with the ID gallery" would be "ul#gallery" (or just "#gallery" since IDs must always be unique) instead of "footer".
luisgomez7
5,557 PointsNo, I was referring to the third task. I thought I made that clear. I figured out task two on my own but it doesn't really matter now. Once again, thanks for your help.
luisgomez7
5,557 Pointsluisgomez7
5,557 PointsYour solution didn't work but (' footer img') did. Thanks for your help anyway.
Steven Parker
231,261 PointsSteven Parker
231,261 PointsLooks like we got the tasks confused. The objective you listed above is for task 2 (which is the one my answer was for, but you must have already solved), yet apparently you were actually working on task 3 which has this objective instead:
"Finally, select all images inside the
footer
element and assign them to the variablefooterImages
."