all I made some of testing code that looks like this.
var selects = [$('#elem1'), $('#elem2'), $('#elem3')];
$.each(selects, function(item){
selects[item].bind('click', function(){
console.log("each function : " + item);
});
});
for(var i = 0; i < selects.length; i++){
var elem = selects[i];
elem.bind('click', function(e){
console.log("for loop : " + i);
});
}
I made three buttons to be bound to event. and tested
If I click the button identified by name 'elem1', the result is :
console $
each function : 0
for loop : 3
and also If I click the button identified by name 'elem2', the result is :
console $
each function : 1
for loop : 3
What happened between two loop example? Please let me know.
Thank you, have a nice day.