In the example below, the Jquery code changes the src of the images on the page to start with "test"
, and end with ".jpg"
, but what tells it what i
is? if i'm correct, i
could also be number
, or e
, or z
, or n
, or whatever word or letter i want, so, by placing that i
in there, is it saying that i
is the current object? or the name of the object? or is it just a variable, and if it's a variable, what tells it what the variable holds? what is i
? is it a number? and if I were to change the i
to an h
, would that be the same?
$("img").each(function(i){
this.src = "test" + i + ".jpg";
});
HTML:
<img/><img/>
Result:
<img src="test0.jpg"/><img src="test1.jpg"/>
anyone know any good tutorials that would address this specifically?