querySelectorAll()
noun
say it: “KWEER-ee suh-LEK-ter AWL” /ˈkwɪəri səˈlɛktər ɔːl/
A DOM method that returns every element matching a CSS selector.
What is querySelectorAll() in JavaScript?
querySelectorAll() — A DOM method that returns every element matching a CSS selector, as a list you can loop over with forEach. querySelector() returns only the first match.
document.querySelectorAll(".price").forEach(price => {
price.classList.add("sale");
});
In a sentence
- “querySelectorAll(".price") gave me every price on the page.”
Level: Journeyman · More JavaScript terms at this level
Updated