I figured I’d make a quick post about a problem I had while working with Google Maps API; this problem came up when I needed a DOM element to trigger a click on a Marker so an InfoBubble came up (http://blog.michaelhelmick.com/2011/04/23/google-maps-api-multiple-markers-multiple-infowindowsinfobubbles/)
I needed to trigger a ‘click’ on a certain marker when I clicked a DOM Element. And you can’t just do markerInstance.click();
To force the click, you need to call google.maps.event.trigger which takes two params (instance, event)
So, in our code, when anything with the class ‘forceMarkerClick’ is clicked, it calls that event and uses the item in our markerArray with the index that is available on the anchors data-markerId attribute as the instance and ‘click’ as the event.
For more information about google.maps.event.trigger, please view the Google Maps API documentation on it:
Hope this helps!