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 trialKyle Adams
10,180 PointsWhat Am I Doing Wrong? All Elements in a Document using querySelectorAll.
In the final quiz of DOM Selector - More Review, I'm asked this question:
"How would you use querySelectorAll to obtain a reference to all elements in a document with the class student-info and assign it to the constant studentInfo?"
Answers I've tried (all on separate tries and all fail):
const studentInfo = document.querySelectorAll( '.student-info' );
const studentInfo = document.querySelectorAll( ".student-info" );
const studentInfo = document.querySelectorAll( .student-info
);
const studentInfo = document.querySelectorAll( '.student-info' )
const studentInfo = document.querySelectorAll( ".student-info" )
const studentInfo = document.querySelectorAll( .student-info
)
I'm unsure of where I'm going wrong, not getting any hints, and failing the quiz/stuck in this section if this one question is wrong. Please help!
1 Answer
Steven Parker
231,269 PointsYou might also wish to report this as a bug directly to the staff as described on the Support page.
Kyle Adams
10,180 PointsI’ve done that as well, thanks Steven.
Steven Parker
231,269 PointsIf you're the first to report a legtimate bug, you should get an "Exterminator" badge.
Kyle Adams
10,180 PointsKyle Adams
10,180 PointsI finally figured it out! It's been at least 30 minutes of taking that quiz over and over, but the problem was spacing.
Apparently JavaScript doesn't mind spacing but the Treehouse quiz does. The final solution was:
document.querySelectorAll(".student-info");
No spaces, anywhere. I'm updating with this comment in case anyone else is stuck here as well!