π INDEX
LOADING ENGINE...
JS Selection
Learn to capture DOM elements like a pro.
selection.js1/4
π
DOM Preview
Tutor: To manipulate the DOM, we first need to select the elements. 'document.getElementById()' is the fastest method if you know the unique ID.
DOM Mastery Tree
getElementById()
This is the most efficient method to select an element when you know its unique ID in the HTML.
const header = document.getElementById('main-header');
Achievements
π―
Selector Master
Successfully used querySelector and getElementById.
π§
DOM Navigator
Understand the difference between ID and Class selection.
β‘
JS Expert
Mastered modern element selection methods.
Selection Glossary
- .querySelector()
- Returns the first element that matches a CSS selector (class, ID, or tag).
- .querySelectorAll()
- Returns a static NodeList of all elements that match the selector.