querySelector()

noun

say it: “KWEER-ee suh-LEK-ter” /ˈkwɪəri səˈlɛktər/

A DOM method that returns the first element matching a CSS selector.

What does querySelector() do in JavaScript?

querySelector() — A DOM method that returns the first element matching a CSS selector.

const button = document.querySelector("#checkout");

In a sentence

  • “querySelector("#cart .total") found the cart's total.”

Level: Journeyman · More JavaScript terms at this level

Updated