title: A function inside a for loop with jQuery and Javascript
body: <p>i have the following code :</p>
  
  <pre><code>$(document).ready(function () {
      for (i = 1; i &lt;= number_of_banners; i++) {
      var selector = "#link_" + i;
      $(selector).click(function () {
          alert(i);
          });
      }
  });
  </code></pre>
  
  <p>but the alert() can't get the "i" variable from the for loop.
  How can I use the i variable of for loop inside the .click function ?</p>