You want the event listener to apply to many items, for example, to all the
h2 elements on the page. You don’t need to add the event listener multiple times to each element. You add the event listener once, which checks if an
h2 element was clicked.
Here is a working example. In this example, the
h2 headings have the class