title: jquery loop holding last value
body: <p>I have divs with numbered ids that I want to process on the click event:</p>
  
  <pre><code>$(function() { 
      for (var i = 1; i != 10; ++i) {
         $("#div" + i).live('click', function () {
             //...
             console.log(i); // always prints 10
         });
      }
  });
  
  // html
  &lt;div id="div1"&gt;...&lt;/div&gt;
  &lt;div id="div2"&gt;...&lt;/div&gt;
  etc.
  </code></pre>
  
  <p>I was expecting that a click event on each div will fire its own event handler. But that is not the case. </p>
  
  <p>Any fix please.</p>