I am working on a webapplication. I have a google map, where I add polygons from an array. I loop through that array and add the polygons to the map. I also need to add an e
Move the code block inside the for-loop.
//Add the click listener
google.maps.event.addListener(p, 'click', function (event) {
//alert the index of the polygon
alert(p.indexID);
});
OR
You add this to for-loop,
p.addListener('click', clickSelection);
and do this
function clickSelection(){
alert("Clicked");
}