← Back to topic library
Dev MaxxingBeginnerJavaScript60 sec
Browser event
A browser event is a signal fired when something happens on a page, such as a click or a key press, that JavaScript code can listen for and react to.
Prerequisite: Document Object Model
What matters
Events are the mechanism that connects user actions to code, which is what lets a page respond to interaction instead of only ever displaying static content.
Example
Attaching a 'click' event listener to a button runs a specific function every time a user clicks it.
Common misconception
A browser event is not limited to direct user actions like clicks; events also fire for things like a page finishing loading or a network request completing.
Recall question
What connects a user's click on a page to code actually running?
Keywords and related concepts
browser eventevent listeneruser interactiondocument object model