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 DOM selection review questions , please help

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 ? const studentInfo = ______________________

That's the question that is asked above Can someone please show me the correct way to answer the question??

2 Answers

Steven Parker
Steven Parker
231,261 Points

The selector would be similar to what you would use for CSS.

Since class selectors are identified with a period, the answer would be:

document.querySelectorAll(".student-info")

Thank you so much I was stuck on this for an hour or two then work hours hit me only just managed to get back to it Thanks a bunch !!!