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);
...
marker.openInfoWindowHtml("<span class=\"foo\">myText</span>");
does not work. Why the event isn't caught inside the InfoWindow ?
After constructing an InfoWindow, you must call open to display it on the map. The user can click the close button on the InfoWindow to remove it from the map, or the developer can call close() for the same effect.
Hi, You can use "infowindow. view" property.
An InfoWindow displays content (usually text or images) in a popup window above the map, at a given location. The info window has a content area and a tapered stem. The tip of the stem is attached to a specified location on the map. Info windows appear as a Dialog to screen readers.
I couldnt get it working like Kevin Gorski explained...
with jquery 1.9.1 and maps api v=3.exp the following works:
infowindow.setContent('<a href="#" id="test">test</a>');
google.maps.event.addDomListener(infowindow, 'domready', function() {
$('#test').click(function() {
alert("Hello World");
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With