DOM
Definition
Document Object Model — a tree-structured representation of an HTML document that allows JavaScript to read and manipulate page content, structure, and styles. Every HTML element becomes a node in the DOM tree.
Code Example
Javascript
Tip: Modify the code above and click “Run” to see the results
Learn More
Related Terms
Event Listener
A function attached to a DOM element that executes when a specific event (click, keypress, submit, etc.) occurs on that element. Added with addEventListener and removed with removeEventListener.
Query Selectordocument.querySelector() returns the first element matching a CSS selector. querySelectorAll() returns all matching elements as a NodeList. These are the modern replacements for getElementById and getElementsByClassName.