I am busy with a script that will make a google maps canvas on my website, with multiple markers. I want that when you click on a marker, a infowindow opens. I have done tha
For loops that creates infowindows dynamically, declare a global variable
var openwindow;
and then in the addListenerfunction call (which is within the loop):
google.maps.event.addListener(marker, 'click', function() {
if(openwindow){
eval(openwindow).close();
}
openwindow="myInfoWindow";
myInfoWindow.open(map, marker);
});