Hello, I have a simple question concerning Javascript. I am trying to print in a loop some values to div container. The problem is that instead printing the value several times in a loop, each time it is overwritten and as a result I get only one value. See the code below:
for (i=0; i<json.Locations.length; i++) {
var location = json.Locations[i];
var content = document.getElementById('eventsnearby');
var html = location.name;
content.innerHTML = html;
}
Any ideas welcomed. Thanks.