Vittorio Tiozzo
Posts: 0
Joined: Mon Jul 28, 2014 8:33 am

Removing marker problem

ello, I can't find out why this code doesn't work:
vHar map = new Appery('gmap2').gmap;

var markerLatLng = new google.maps.LatLng(localStorage.getItem("markerLat"), localStorage.getItem("markerLng"));
var Titolo = 'Some Title';

var gmarkerks = [];
var marker = new google.maps.Marker({
position: markerLatLng,
map: map,
title: Titolo,
animation: google.maps.Animation.DROP},
gmarkers.push(marker));

function setAllMap(map) {
for (var i = 0; i < gmarkers.length; i++) {
gmarkers.setMap(map);
}
}

function showMarkers() {
for (var i = 0; i < markers.length; i++) {
gmarkers.push(new google.maps.Marker(markers));

Code: Select all

 } 
 map.fitBounds(bounds); 
 setAllMap(map); 

}

google.maps.event.addListener(marker, 'click', function() {gmarkers.pop();
map.refresh();
setAllMap(map);
});

All that I want is to remove the last marker that the user has added to the page when the user clicks on a marker.
Thank you

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Removing marker problem

Vittorio,

Please look at this link, information there should be useful: https://developers.google.com/maps/do...

Blair Cox
Posts: 0
Joined: Thu Jun 04, 2015 2:29 pm

Removing marker problem

Vittorio - did you get this to actually work?? I only get...

Uncaught ReferenceError: setMapOnAll is not defined or setMapOnAll is not a function

Return to “Issues”