title: Why are my jQuery events not binding properly when in a loop?
body: <p>I am using the jQuery hotkeys plugin to bind some keypresses to events. I tried to change this to bind looping over an array instead, but it's not working. </p>
  
  <pre><code>var letters = ["a","b","c"];
  for (var x in letters)
  {
      var letter = letters[x];
      $("el").bind('keydown', letter, function() { /*...*/  })
             .bind('keyup', letter, function() { /*...*/  });
  }
  </code></pre>
  
  <p>This code binds all events to the last letter in the array ("c") and none to others. Is there a better way of doing this ? Thanks a lot.</p>