How can I show the marker for particular location on the map using leaflet.js

55 Views Asked by At

I am using the following code:

var cord = ["12.9791198", "77.5912997"];

// custom id for marker
var customId = Math.random();

var marker = L.marker([cord[1], cord[0]], {
  title: selectedObj.display_name,
  id: customId,
})
  .addTo(map)
  .bindPopup(selectedObj.display_name);

map.setView([cord[1], cord[0]], 8);

and for this i am getting error like Uncaught TypeError: t.addLayer is not a function

0

There are 0 best solutions below