Answer the question
In order to leave comments, you need to log in
How to access a marker on a Google map by id?
There is a map with a bunch of objects, objects in the form of markers. When you click on a marker, you need to hide everything except the clicked one. How to hide all markers found in the example in the docks:
// Sets the map on all markers in the array.
function setMapOnAll(map) {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(map);
}
}
// Removes the markers from the map, but keeps them in the array.
function clearMarkers() {
setMapOnAll(null);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question