Home » Google » How to get a click event inside of google maps infowindow

How to get a click event inside of google maps infowindow

Jquery events foroogle maps infowindow elements are not work inside $(document).ready(function(){}) or script> tag because the elements not added to the dom when browser execute the jQuery.

Solution for this problem is need to add one click listener for google maps infowindow.

google.maps.event.addListener(infowindow, 'domready', function(e){
//Put your jQuery code here
});

//example of infowindow jquery click

google.maps.event.addListener(infowindow, 'domready', function(){
$('#btn-test').click(function(e) {
e.preventDefault();
alert('smart click');
});
});

Leave a Reply

x

Check Also

10 Google Interview Questions shared by an engineer who attend the test

1. What is the opposite function of malloc() in C? Answer: free(). 2. What Unix ...