I can\'t get my markers to display different infowindows. The markers always display the content of the last \"contentString\".
I\'ve read a few other posts but none
Im having the same problem. I was able to get the title show up different though using this code:
setMarkers(map, airports);
}
function setMarkers(map, locations)
{
//you only need 1 infoWindow
var infowindow = new google.maps.InfoWindow({
content: "holding" //content will be set later
});
for (var i = 0; i < locations.length; i++)
{
var airport = locations[i];
var myLatLng = new google.maps.LatLng(airport[1], airport[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: airport[0],
zIndex: airport[3],
html: airport[4],
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(this.html);//set the content
infowindow.open(map,this);
});
}
}