BTW, can someone tell me how to bind an event to multiple objects through a for loop?
At first I tried going simple like:
Code:
function somefunc(){
var id;
for(i=0;i<10;i++)
$("#"+id+i).bind('mouseleave', function(){});
}
And after realizing that the bind worked only for the last element of the loop(which obviously is not what I want), I changed it to
Code:
function mbind(sId){
return function(){
$("#"+sId).bind('mouseleave', function(){});}
}
function somefunc(){
var id;
for(i=0;i<10;i++)
(mbind(id+i))();
}
expecting it would now work for all elements in the loop, but hell no!
Can anyone help me with this?