William Walseth
William Walseth

Reputation: 2923

Enumerate all Map Markers

Can anyone share some JavaScript that enumerates all markers in a Google Map? Need script for v2 and v3 if possible. Thanks.

Upvotes: 2

Views: 233

Answers (1)

Kasper Vesth
Kasper Vesth

Reputation: 4113

The only time you have access to the markers and can enumerate them is when they are created. The map has no awareness of what markers are attached to it, and it seems like you want to be able to do it on a map that has been initialised and markers have been added.

In other words, that is not possible. The way to do this is to put the markers into an array while you make them.

Upvotes: 2

Related Questions