In the example below, jQuery code changes the src of the images on the page, starting at "test", and ending with ".jpg", but what tells it that i? if I'm right, iit can also be numbereither e, or z, or n, or any other word or letter that I want, therefore, placing it there ihe says that it iis the current object? or object name? or is it just a variable, and if it's a variable, what tells her that the variable matters? what i? is that number? and if I changed the value ito 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"/>
Does anyone know any good tutorials that would specifically deal with this?
source
share