Skip to content

How can I update a Marker custom option? Javascript and Leaflet

I have a leaflet map with some Markers and I need to update custom option inside Marker option when I make doble click on each Marker.

    extendedMarker = L.Marker.extend({
        options: {
            idUser: "Not Assigned",
            color: 'grey',
            localtion: 'Not Assigned'

I only can create new Marker with this new info but this will take so much space.

Default options in Marker like latitude, longitude or icon have specific setFunction but custom options don’t.

Someone knows optimal option to update Marker options?


You can simply access the marker options over marker.options.

To update a option marker.option.idUser = '1234'