is there a way to add a popup to a marker but only show it when it is clicked? As it seems to be default to show it when one is loaded?

This is no good when markers are getting updated?

Currently using this

 mymarker = new L.Marker(e.latlng, {
                icon: yellowIcon,
               draggable: true
             });


             map.addLayer(mymarker);
             mymarker.bindPopup('<p>You are here ' + username + '</p>').openPopup();

Cheers

up vote 2 down vote accepted

Just leave out call of .openPopup() method:

mymarker.bindPopup('<p>You are here ' + username + '</p>');

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.