# Locating DOM elements

Most searches start at the document, the whole page, where getElementById finds an element by its id, querySelector finds the first match for a CSS selector, and querySelectorAll finds every match.

![Cheat sheet: Locating DOM elements](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/c862257a991444f4b3237da26a3eca7e.webp)

- Category: JavaScript
- Level: Apprentice
- Tags: getElementById(), JavaScript, querySelector(), querySelectorAll()
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/introducing-the-dom-locating-dom-elements-cheat-sheet
