guys given the following code :
Jquery :
- $('div').each(function(i){
-
- alert(i);
-
- });
and the following HTML code :
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
- <div></div>
On document load .. and alert pops up 6 time .. everytime displaying a value which increments from 0 to 5 .
now i have a confusion , nowhere in the Jquery code have i explicitly specified that i want the i (That i can be changed to "index" or even "bla" ) to be the current index of the elements , so why when i pass a variable in the function , does it act as the current index of the elements being iterated over ?
Thank you.
Gautam.