33. Handling Events for Multiple Elements

In This Chapter

Learn to efficiently react to multiple events

Revisit how events work for one last time

In its most basic case, an event listener deals with events fired from a single element:

Image

As you build more complicated things, the “one event handler for one element” mapping starts to show its limitation. The most common reason revolves around you creating elements dynamically using JavaScript. These elements you are creating can fire events that you may want to listen and react to, and you can have anywhere from a handful of elements that need eventing support to many MANY elements that need ...

Get JavaScript Absolute Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.