addEventListener
addEventListener is a web API method that registers a callback to run when a specified event occurs on an event target.
React Quickly, Second Edition
addEventListener is a browser API method that registers a function to be invoked for a specified event on an event target.
- How it is used
- Registers browser-level handlers for window, document, and referenced DOM nodes outside React’s event properties.
- How deep it goes
- Explains registration, capture options, propagation phases, React effects, state updates, and unmount cleanup.
- Examples
- Demonstrates click listeners, capture listeners, referenced DOM nodes, and a React window-resize display.
- What you can do after
- Operate/configure direct browser listeners, select capture behavior, update React state, and remove handlers during unmount.
Read how React Quickly, Second Edition explains addEventListener →
Secrets of the JavaScript Ninja, Second Edition
A DOM method for registering an event listener on an event target without replacing existing listeners for the same event type.
- How it is used
- Registers browser event handlers so client-side applications can respond to user actions.
- How deep it goes
- Defines registration, contrasts property assignment, and demonstrates multiple event types; leaves event-processing flow for later.
- Examples
- Demonstrates body mousemove and click handlers that append labeled messages to a list.
- What you can do after
- Apply the DOM method to register multiple handlers for specified events.
Read how Secrets of the JavaScript Ninja, Second Edition explains addEventListener →
Related concepts
- event-handler registrationuses · Event-handler registration is the association of a handler with an event target or type so it can run when that event occurs.
- feature detectionused by · Feature detection is the practice of testing at runtime whether an environment supports a particular capability.
- windowused by · The browser window object is the global object for a browsing context, exposing its document, JavaScript environment, and associated browser APIs.
- on()alternative to · on() is a D3 selection method that registers an event listener for a specified event type and callback function.
- handleruses · A handler is a callable or software component that processes an event, request, message, or other input and performs associated processing.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

