I am trying to run the following code:
I pass parameter to a function, but it always has the value of the last object run through the loop. I read some articles abou
You can avoid the clouseres problems with the eventData parameter of the bind function like this
var message = 'Spoon!';
$('#foo').bind('click', {msg: message}, function(event) {
alert(event.data.msg);
});
message = 'Not in the face!';
$('#bar').bind('click', {msg: message}, function(event) {
alert(event.data.msg);
});
this is from the jquery bind api documentation http://api.jquery.com/bind/#passing-event-data