I want to remove the "Leaflet.com" that appears on the right bottom of the screen
here. How can I do that?
Best Answer
The Leaflet way: L.map('map', {attributionControl: false, etc...})
A simple $('.leaflet-control-attribution').hide() or non jQuery document.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';.
Try something like this. Put the marker to a variable, and when creating a new one, it the variable already has a value remove it from the map, then draw the new marker.
var theMarker = {};
map.on('click',function(e){
lat = e.latlng.lat;
lon = e.latlng.lng;
console.log("You clicked the map at LAT: "+ lat+" and LONG: "+lon );
//Clear existing marker,
if (theMarker != undefined) {
map.removeLayer(theMarker);
};
//Add a marker to show where you clicked.
theMarker = L.marker([lat,lon]).addTo(map);
});
Best Answer
The Leaflet way:
L.map('map', {attributionControl: false, etc...})
A simple
$('.leaflet-control-attribution').hide()
or non jQuerydocument.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';
.Vladimir himself says it's OK to remove it: https://groups.google.com/d/msg/leaflet-js/fA6M7fbchOs/JTNVhqdc7JcJ, but it seems like you should leave it or acknowledge Leaflet in some way.