1 | initial version |
The method for adding markers to a map with the Leaflet "click" event handler is:
Here is an example code snippet:
map.on('click', function(event) {
var marker = L.marker(event.latlng);
// add popup content
marker.bindPopup("<b>Hello World!</b><br>I am a popup.").openPopup();
map.addLayer(marker);
});