google map v3- only marker on map
-
20-09-2019 - |
Question
Could some one advice, how can i got only one/Unique marker on google map v3. All previous markers should be removed when i create new makrer on map.
Thanks
Solution
You need to keep track (an array) of all the marker objects on your map. You need to iterate through them, setting their map
property to null
. From the docs:
To remove a marker, call the setMap() method passing null as the argument.
http://code.google.com/apis/maps/documentation/v3/overlays.html#Markers
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow