Select a paragraph element with the ID intro, change its text to "Welcome to JavaScript DOM!", and make its text color red.
The Document Object Model (DOM) is how JavaScript interacts with the structure of an HTML page. You can select elements, change their content, and modify their style using DOM methods.
let heading = document.getElementById("main-heading");
let paragraphs = document.getElementsByTagName("p");
let firstButton = document.querySelector("button");
Changing Content
heading.textContent = "New Heading Text";
Changing Stylesheading.style.color = "blue";
heading.style.fontSize = "24px";
Creating and Adding Elements
let newDiv = document.createElement("div");
newDiv.textContent = "Hello, DOM!";
document.body.appendChild(newDiv);