Click event in Google Map InfoWindow not caught

前端 未结 6 1838
暖寄归人
暖寄归人 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:24

    Try this:

    google.maps.event.addListener(infowindow,"**domready**",function() {
        var Cancel = document.getElementById("Cancel");
        var Ok = document.getElementById("Ok");
    
        google.maps.event.addDomListener(Cancel,"click",function() {
            infowindow.close();
        });
    
        google.maps.event.addDomListener(Ok,"click",function() {
            infowindow.close();
            console.log(position);
            codeLatLng(position);
        });
    });
    

提交回复
热议问题