Click event in Google Map InfoWindow not caught

前端 未结 6 1833
暖寄归人
暖寄归人 2021-02-08 13:43

With Google Map v2, I would like to be able to trigger a function when clicking a text in the InfoWindow of a GMarker.

$(\".foo\").click(myFunction);

...

marke         


        
6条回答
  •  甜味超标
    2021-02-08 14:16

    As far as I know, GMaps injects content into the InfoWindow programatically, so any bound event handlers on the injected elements will not fire unless you use event delegation:

    $(".foo").live("click", myFunction);
    

    See the live event handlers.

提交回复
热议问题