JavaScriptHTML + CSS + JavaScript
Draft saved locallyJavaScript · Spaces: 2
Live preview move your pointer inside
JavaScript Meets the Page
The browser turns your HTML into a live page called the DOM. JavaScript can find an element and change it.
const message = document.querySelector("#message");
message.textContent = "New words";document.querySelector(...)finds the first matching element.#messagemeans “the element whose ID ismessage”.textContentis the text inside that element.
Learn more
01
Your mission
Change the message paragraph from JavaScript when the page runs.
- Create a constant named
messagethat selects#message. - Set
message.textContentto exactlyMagic activated! ✨.
Check my work Run project