How can I add multiple button with events for Leaflet Marker tool

1.6k Views Asked by At

I wanted to add more button along with this Cancel button, When user click on marker from leaflet toolbar. Please suggest me the solution or any plugin which helps to achieve this requirement.

enter image description here

1

There are 1 best solutions below

1
On

You can use the Plugin Leaflet-Geoman

function onclick(e){
    console.log('CLICK')
}

// add a new custom control
map.pm.Toolbar.createCustomControl({
  name: 'CustomButton',
  block: 'draw',
  className: 'control-icon leaflet-pm-icon-marker',
  actions: [{
    text: 'Cancel', 
    onClick: onclick 
  }]
})

Go to custom button doc and then scroll to Adding New/Custom Controls

Example: https://jsfiddle.net/falkedesign/6x9cknft/