Using the Google Maps API v3 for the first time, and I have a map with a bunch of markers. I wanted to do this, when you click one, the specific InfoWindow (specific to the marker that you clicked) will be displayed. I was very surprised that the click event does not tell you the actual marker that was clicked!
I know there is a solution that uses a separate method to create a closure, but for me it seems like a hack. Is there a better way to do this? Or is there a way to ask the map βwhat markers exist in this positionβ and pass the position from the event argument?
I expected events to work as follows:
google.maps.event.addListener(marker, 'click', function(event, obj)
{
});
source
share