Я пытался просмотреть большое разнообразие блоков кода здесь и в документации по API Карт Google, но STILL не смог понять, как скрыть маркеры.
Это текущий код, который я использую, и он работал для одного экземпляра. Как только я добавил цикл for в функцию с markers.setMap(null), Firefox отображает следующую ошибку:
Ошибка: TypeError: markers.setMap не является функцией
function removeMarkers(){
var markers;
alert(markers);
alert(locations.length);
for (i = 0; i<locations.length; i++){
markers = locations[i];
alert(markers.title);
markers.setMap(null);
}
}
Дополнительная информация: Карта кампуса и полный код (кроме Map API)