Complete the DOM Query
Fill in the Blank Beginner
Question
Fill in the blank to get the element with id='header'.
Code
const header = document.___("header");
Hint
It is the classic DOM method for finding an element by ID.
Explanation
document.getElementById('header') returns the element with id='header'. It is the fastest and most specific DOM query method. Unlike querySelector, it does not need a '#' prefix — you pass the raw ID value.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.