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


Colin Warn
Colin Warn
6,358 Points

document.querySelectorAll not getting a class that I'm looking right at?

Picture for context: http://imgur.com/a/1OF3v

To practice extracting text from HTML, I decided to open up a page on my college website to see if I could extract the names of the classes I planned to take.

I'm trying to extract the "Manufacturing Processes Lab" text. I initially tried document.getElementById('CRSE_DESCR$'), was returned an element with length zero and nil values. I then tried document.querySelectorAll('.PSHYPERLINK') to see if I could even get back an array with classes, still getting a result with length 0.

No idea what I'm doing wrong here. Any ideas given that I'm trying to extract "Manufacturing Process Lab"?

1 Answer

Steven Parker
Steven Parker
229,920 Points

Did you change "document"?

I'm wondering if despite the error you managed to change the value of "document" on the previous line. Otherwise, I can't imagine why you would have gotten an empty NodeList.

I would refresh the browser and be careful not to make that same error in the console.