0

I'm using a javascript library "JS Maps" to show maps.

to add event, I want to use for loop but it is not working.

var i = 2;

  jsMaps.api.attach_event(markers[i],'mouseover',function() {
      infowindows[i].open(map,markers[i]);
    });

  jsMaps.api.attach_event(markers[i],'mouseout',function() {
      infowindows[i].close();
    });

  var j = 3;

  jsMaps.api.attach_event(markers[j],'mouseover',function() {
      infowindows[j].open(map,markers[j]);
    });

  jsMaps.api.attach_event(markers[j],'mouseout',function() {
      infowindows[j].close();
    });

This works, but doing this using for loop does not.

0 Answers0