I need to display multiple markers on a map, each with their own infowindow. I have created the individual markers without a problem, but don\'t know how to create the infow
I tried the code from Sean Vieira, I was struggling to get the infowindow show me same corresponding markers Info.
If you have same problem try: Here we are setting info (you can keep any name ) and then latter will use it.
var marker = new google.maps.Marker({
map: map,
position: myLatlng,
title: _park.title,
info : _park.infoWindowContent, // note info here
clickable: true,
});
next see Content, so we are using the info we want to set to Marker
google.maps.event.addListener(marker , 'click', function() {
infowindow.setContent(this.info);
infowindow.open(map,this);
});
This worked for me.
Ref: https://tommcfarlin.com/multiple-infowindows-google-maps/