.each Test
Testing the index value passed by .each function
HTML
<ul>
<li>foo</li>
<li>bar</li>
</ul>
JavaScript
$( "li" ).each(function( index ) {
console.log( index + ": " + $( this ).text() );
});
<ul>
<li>foo</li>
<li>bar</li>
</ul>
$( "li" ).each(function( index ) {
console.log( index + ": " + $( this ).text() );
});