I want change somethings after click events, but I need use while loop for make short code.
for example:
$('#DIV1').click(function() {
// DoSomething
}
$('#DIV2').click(function() {
// DoSomething
}
use while loop for that
var i = 1; var ExapmleVar
while(i < 5)
{
$('#DIV' + i).click(function() {
ExapmleVar = i;
}
}
in the result ExapmleVar = 6 it's not true for me i want ExampleVar equal to 1 in first loop and equal to 2 in second loop and etc