Loading Depth Study
Preparing your workspace
Events represent things that happen in the browser, such as clicks, typing, form submission, focus changes, and page loading.
Web applications need to react to user actions. Browsers create events when something happens, and JavaScript can register event handlers that run in response. Common events include click, input, submit, change, focus, blur, keydown, and load. Event handling is a core part of interactive web development.
A course interface can listen for a button click and mark a lesson as completed when the user finishes it.
<button id="complete">Complete Lesson</button>
<script>
const button = document.getElementById("complete");
button.addEventListener("click", () => {
console.log("Lesson completed");
});
</script>Clicking the button logs Lesson completed.