So when I make click on the map a new marker is added, but if there's
a prev marker, it get deleted
var prevMarker = null;
google.maps.event.addListener(map, "click", function(event) {
placeMarker(event.latLng);
prevMarker = event.serviceObject;
});
function placeMarker(location) {
var clickedLocation = new google.maps.LatLng(location);
if (prevMarker != null) {
prevMarker.setMap(null)
}
var marker = new google.maps.Marker({
position: location,
map: map
});
};
};
But the code is just adding markers but no deleting previous ones
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.