DOM for Beginners: Change the Web Page
Connect JavaScript to HTML elements on your site.
The DOM is how JavaScript sees your HTML. Select an element, then change it.
const title = document.querySelector("h1");
title.textContent = "You did it!";This is how buttons, counters, and games come alive on the web.