Querying the DOM - Selectors
document.querySelector
document.querySelectordocument.querySelector("button"); // searches for the first <button> tag
document.querySelector(".vintage"); // searches for the first tag with the "vintage" class
document.querySelector("#nexus"); // searches for the first tag with the id "nexus"document.querySelectorAll
document.querySelectorAlldocument.getElementById
document.getElementByIddocument.getElementsbyClassName
document.getElementsbyClassNamedocument.getElementsByTagName
document.getElementsByTagNameNext steps
Last updated