Click here to Skip to main content
15,881,684 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do you deal with the markers in Leaflet Map? My question here is that when i place a marker on the map and place another different marker in the map the first marker always come or combined with the other image.

Here is my Code

JavaScript
var note = document.getElementById('note');
var datepick = document.getElementById('demo1');
var timepick = document.getElementById('timepick');
        layerpoly.on('click', function(e){
        var markerB = new L.Marker(e.latlng,{icon: Icon3});
        markerB.bindPopup("HOMICIDE</br>Date:"+datepick.value+"</br>Time:"+timepick.value+"</br>Address:"+note.value+"").addTo(map);
    map.addlayer(markerB);
closure2 (markerB)


is there something wrong in click event i just want that no other markers will come together with the marker i selected? any help is appreciated TYIA!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900