Browser events
We can listen for any kind of event using JavaScript, including browser-initiated events, or user-initiated events.

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


JavaScript in the browser uses an event-driven programming model.

A web page is loaded, and nothing happens until the user does something.

It could be clicking a button, or focusing on an input box and starting typing. Or submitting a form.

When this kind of interactivity happens, you can “hook” in the workflow using JavaScript.

Things start by responding to an event with an event handler.

Lessons in this unit:

0: ▶︎ Introduction
1: Handling events
2: The `DOMContentLoaded` event
3: The `event` object
4: Mouse events
5: Keyboard events
6: `preventDefault()`
7: Stopping event propagation
8: Bubbling and capturing
9: Form submit event
10: Input fields events
11: Creating custom events
12: Keyboard Events
13: Mouse Events
14: Touch Events
15: Form Events