Lesson 8 of 10
DOM Manipulation
The DOM (Document Object Model) is a tree of HTML elements that JavaScript can read and modify. Use document.querySelector() to find elements and change their content or style.
JS
// Find an element
const title = document.querySelector("h1");
// Change its text
title.textContent = "New Title";
// Change its style
title.style.color = "blue";