HTML:
<ul> <li>Mango</li> <li>Book</li> </ul>
Script:
$( "li" ).each(function( index ) { console.log( index + ": " + $( this ).text() ); });
A message is thus logged for each item in the list:
0: Mango
1: Book