I have 4 markers being displayed on a map and the infowindows of the all contain an array of unique strings and an image next to the string.
my problem is that I'm trying to change the images every minute and they change only if i have the info window open and then only that info window will change the closed ones will not update.
here is the method im using to update it:
setInterval(update, 1000 * 60);
function update(){
for(var i = 0; i < data.length; i++){
for(var j = 0; j < data[i].test.length; j++){
var test = data[i].test[j];
test = test.replace(/ /g, '');
test = test.replace(/[-]/g,'');
test = test.replace(/[()]/g, '');
$('.'+test).html("<img src='Images/red.gif' />");
//class of the span image is being placed into
}
}
}
I'm just looking for some advice on if i can modify the data within the closed info windows.
I'd just like to mention I'm not looking for code but just some advice.
Thank you in advance
I have 4 markers being displayed on a map and the infowindows of the all contain an array of unique strings and an image next to the string.
my problem is that I'm trying to change the images every minute and they change only if i have the info window open and then only that info window will change the closed ones will not update.
here is the method im using to update it:
setInterval(update, 1000 * 60);
function update(){
for(var i = 0; i < data.length; i++){
for(var j = 0; j < data[i].test.length; j++){
var test = data[i].test[j];
test = test.replace(/ /g, '');
test = test.replace(/[-]/g,'');
test = test.replace(/[()]/g, '');
$('.'+test).html("<img src='Images/red.gif' />");
//class of the span image is being placed into
}
}
}
I'm just looking for some advice on if i can modify the data within the closed info windows.
I'd just like to mention I'm not looking for code but just some advice.
Thank you in advance
Share Improve this question asked Dec 6, 2012 at 18:56 Roy James SchumacherRoy James Schumacher 6462 gold badges11 silver badges27 bronze badges 1- Possible duplicate of Changing the Google Maps Marker HTML after a function is ran – Danish Adeel Commented May 15, 2016 at 9:09
1 Answer
Reset to default 4You can change the content in the "closed" InfoWindows if you have access to it. One option would be to store the HTML (or the info required to create the HTML) in member variables of the marker. Use that information to populate the InfoWindow when it is opened on click. You can change that information at any time; for information in the currently open infowindow, you will have to do that by modifying the DOM.
See the answer to this similar question.