JavaScript
JavaScript HTML DOM MethodsJavaScript HTML DOM Methods
JavaScript DOM methods target and manipulate HTML elements.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
JavaScript provides built-in methods to interact with the DOM tree. Developers use these methods to grab specific HTML tags by their ID or class name, and then change their content or styling without needing to reload the page.
Example
Example
Key Points
- `getElementById()` finds a single unique element.
- `querySelector()` finds elements using CSS selectors.
- The `innerHTML` property changes the HTML content inside.
- The `style` property applies inline CSS changes.