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 trial

JavaScript JavaScript and the DOM (Retiring) Getting a Handle on the DOM DOM Selection - More Review

querySelectorAll question, getting the quiz wrong and don't know why?

I'm not sure what's going wrong here. Can't finish the quiz cause you need all 4 questions right. I'm quite sure i'm getting this right though so this is really confusing me, the question is:

"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?"

They give you this piece of code "const studentInfo = _______________ "

my answer is:

const studentInfo = querySelectorAll('.student-info')

Really not seeing what im doing wrong here so any help would be appreciated

2 Answers

andren
andren
28,558 Points

You are forgetting about document. The answer to the Quiz is: document.querySelectorAll('.student-info')

It's an easy thing to forget, but it's important to remember because querySelectorAll by itself won't get you anywhere since it belongs to the document object.

Thanks a bunch! I totally forget the document.!