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

Ken Okiebisu
Ken Okiebisu
9,673 Points

document.querySelectorAll on classes(Question from quiz)

The question asked my how I would assign all elements with the class ‘student-info’ into the constant studentInfo using the querySelectorAll method. I wrote it as the following:

const studentInfo= document.querySelectorAll(‘.student-info’);

I keey getting it wrong and I don’t know why. I would like to know what is wrong with my code. Thanks.

2 Answers

Emmanuel C
Emmanuel C
10,636 Points

After trial and error of copy and pasting your code, when I use double quotes instead of single quotes, it works. There isnt a big difference between the two, at least in javascript, so your code is correct and I wouldn't worry about it to much.

Ken Okiebisu
Ken Okiebisu
9,673 Points

Thanks for the solution. It helps.