querySelector()

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");

Level: Journeyman · More JavaScript terms at this level

Updated