Finding Elements
- Before JS can update an element, it needs to say which element to change
- The
document
global object has a bunch of methods for finding things document.getElementById("abc")
- Gets a reference to an element with id "abc"document.getElementsByClassName("c")
- Gets all elements with class "c"document.querySelector("#a")
- Finds a single element using a CSS selectordocument.querySelectorAll("header div")
- Finds all elements matching a CSS selector
4 / 17