A park information card starts closed. Visitors can press a real button to reveal that the trail is open; the page must wait for the action instead of updating immediately.
addEventListener("click", showStatus) registers the function; there are no parentheses after showStatus because the browser should call it later. A named function is easy to reuse or remove and keeps the listener line short. The function changes the status with textContent. A native <button type="button"> is focusable and works with mouse, touch, Enter, and Space without writing separate keyboard-click code.
function showStatus() {
document.querySelector("#status").textContent = "Trail is open";
}
document.querySelector("#check").addEventListener("click", showStatus);
Run the preview: before clicking, the status says Not checked. Activate Check trail and it becomes Trail is open. Try calling showStatus() on the listener line, then restore the function reference: the status changes at page load instead of waiting.
Previously, scripts changed the page as soon as it loaded. A listener delays a DOM update until an interaction occurs.
The following exercise uses the same idea in a different setting.