JavaScript JavaScript and the DOM Getting a Handle on the DOM Selecting Multiple Elements

Jason Gralinski
Jason Gralinski
4,985 Points

Order, When entering: let listItems = document.querySelectorAll("#rainbow li"); Why does the ID come 1st?

When entering // let listItems = document.querySelectorAll("#rainbow li"); // why does the ID come first? I understand "look for id that is an li" but look for an "li with id" doesn't seem to work.

1 Answer

adam n
adam n
57,282 Points

That code says "within the element with the id of rainbow, grab all the li elements"

Let me know if this helps here