This example shows how to use a single function to listen to the tap event across multiple map objects held within the same object container.

Code

All H.map.Object elements such as a marker or polygon, along with the H.map.Group container class implement the addEventListener() method, which is used when attaching an event listener.

When a tap event occurs, the fired event is an instance of the H.util.Event class and therefore contains a target property which is the map object clicked.