Mission 05 / DOM and interaction
DOM Interaction
Connect a user action to a selected element, update the page and give visible feedback.
Medium75 XPSelectorsEventsDOM updates
Data flow
JavaScript works with DOM objects
After the browser builds the DOM, JavaScript can select an element and listen for an event. When the event happens, a function updates that element.
const heading = document.querySelector("#title");
const button = document.querySelector("#update");
button.addEventListener("click", function () {
heading.textContent = "Page updated";
});
Sequence challenge