liveBook · Manning

Handler

As explained in Acing the Frontend Interview

An event listener is a registered callback associated with an event target and invoked when a matching event occurs.

An event handler is a callback registered as a listener on an event target; it runs when a matching event occurs. In interviews, handlers also provide a setting to reason about JavaScript scope and `this` binding. section 3.1 section 3.3

Listing 3.10 The click listener attached to the parent
document.getElementById('myList').addEventListener('click', function(e) {
  if (e.target.tagName === 'LI') {
    console.log(`You clicked: ${e.target.textContent}`);
  }
});

A delegated click handler sits on the parent list, filters clicks to list items, and uses the event target to identify the clicked item. section 3.3

How Acing the Frontend Interview covers it

How deep it goes
Defines handlers and demonstrates delegated clicks, without detailing handler registration options or broader event APIs.
Examples
Shows a parent-list click listener that filters for list items and logs the clicked item’s text.
What you can do after
Understand how a parent listener handles bubbled clicks and filters events by their target.
How it connects
Connects handlers to JavaScript scope, this binding, event delegation, and event bubbling.

Also explained in

Compare how 29 books explain handler →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Frontend Interview. The section links point to the parts of the book it draws on.