Skip to content

Google Maps API – Forcing click on Marker

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 (

The Problem

I needed to trigger a ‘click’ on a certain marker when I clicked a DOM Element. And you can’t just do;

The Solution

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!


  1. sang86yi sang86yi

    I can’t speak English. but, I want talk you. Thank you very much. I love you so much.

  2. Thanks you very much for your example, it make me can trigger click on multiple marker

Leave a Reply

Your email address will not be published. Required fields are marked *