I am new in JavaScript and jQuery. I have found a problem which I can't solve myself.
for (i = 0; i < 12; i++)
{
$("#c" + i).on("click", function () { alert(i) });
}
It attaches events to every element with id from c0 to c11 with alert(12) instead of alert(i)...
On the other hand
$("#c0").on("click", function () { alert(0) });
$("#c1").on("click", function () { alert(1) });
$("#c2").on("click", function () { alert(2) });
...
Works good. Isn't it the same?