1

I was following a tutorial and I seems to stuck here:

const list = document.querySelector(".user-list li")

console.log(list)
<body>

    <ul class="user-list">
        <li>Wonder</li>
        <li>Matt</li>
        <li>Alex</li>
    </ul>

</body>

It only takes "Wonder", why is that?

1 Answers1

0

The querySelector() method returns only the first element that matches a specified CSS selector(s) in the document. Try to use querySelectorAll() instead.

user16120973
  • 27
  • 2
  • 8