Hide Particular Marker Google Maps Api
Using current code for google maps api i found on stackoverflow, i need to hide all markers except one clicked how can i do it? Not even sure how to approach it? I think it has to
Solution 1:
If you want to hide the markers you can just call the :
marker.setVisible(false);
You can also remove them by using :
marker.setMap(null);
In your loop you are not keeping track of your created markers. You can push them to an array while creating and on the button click you can iterate through and hide all except the desired one.
var allMarkers = [];
//for loop//your code
allMarkers.push(marker);
//end loop
Then in your hide function, just iterate through all the markers and hide all except the desired one. like allMarkers[index].setVisible(false);
Post a Comment for "Hide Particular Marker Google Maps Api"