How to trigger the onclick event of a marker on a Google Maps V3?

后端 未结 2 663
失恋的感觉
失恋的感觉 2020-11-29 16:35

How do I trigger the onclick event of a marker on a Google Maps from outside the map?

I use version 3 of the API. I\'ve seen many tutorials

2条回答
  •  野性不改
    2020-11-29 16:58

    For future Googlers, If you get an error similar below after you trigger click for a polygon

    "Uncaught TypeError: Cannot read property 'vertex' of undefined"
    

    then try the code below

    google.maps.event.trigger(polygon, "click", {});
    

提交回复
热议问题