Accessing the HTMLElement of a marker's icon in Leaflet

Viewed 1707

I have some markers with custom icons (DivIcons) on my map.

When I click on one marker, I want to access to the HTMLElement of the icon, to add or remove classes.

The only way I have found to access the HTMLElement is the _icon property. I understand it's a private property, but I can't find another way.

The options.icon returns me the icon object (used by many markers), not the concrete HTMLElement for this marker.

Do you know a safe way to access to the HTMLElement of a marker ?

2 Answers
Related