javascript - Failing in iteration -


failing understand why code isn't working ...

the code worked fine before added for condition.

can see went wrong chance ?

$(document).ready(function() {   for(i = 1, < 2, i++) {     $("#info_abonnement" + i).hover(function() {       var pos = $(this).position();       var width = $(this).outerwidth();       $("#info_abonnements" + i).css({         position: "absolute",         top: pos.top + "px",         left: (pos.left + width) + "px"       }).show();     }, function() {       $("#info_abonnements" + i).hide()     });   } }); 

your foreach wrong should like:

for (i=1;i<2;i++){ 

Comments