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

Eric Castillo
Eric Castillo
6,427 Points

Typing document.querySelectorAll('li') in Chrome console returns NodeList with no innerHTML?

In the demonstration in the video, when teacher types document.querySelectorAll('li') into Google Chrome console, he does not return a node list, but instead, all the li elements neatly displayed with the classes and inner html. I get a node list accordion that you need to expand and fish for information. Is there a Chrome setting that I need to toggle here?

Here's what I get:

NodeList(7) [li, li.error-not-purple, li, li, li.error-not-purple, li.error-not-purple, li]

Video: Getting a Handle on the DOM \ Using CSS Queries to Select Page Elements

Adam Beer
Adam Beer
11,314 Points

Show your code.

Code

Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```

1 Answer

I don't know if this is what you're asking, but document.querySelectorAll() returns an array of all the elements with the specified tag name

Eric Castillo
Eric Castillo
6,427 Points

Specifically, it's the way the Chrome console is displaying document.querySelectorAll(). In the video, when the teacher does it, only the list items with the innerHTML is displayed. When I do it, I get a full node list which I need to expand for details.