i have the following code :
$(document).ready(function () {
    for (i = 1; i <= number_of_banners; i++) {
    var selector = "#link_" + i;
    $(selector).click(function () {
        alert(i);
        });
    }
});
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 ?
 
     
     
     
     
    