The jQuery API .each() method allows you to go through each item in a set of items to perform a function on that individual item.

You can iterate through every <p> tag on the page or every <li> tag in an ordered list or a number of different possibilities.

For example, say you have a list of items. You wisht to retrieve the content of each item and perform some action based on that content. The example below will iterate through each <li> tag, retrieve the content of just that one <li> tag, perform an action and then move onto the next <li> tag until there are no more.

$("ul li").each(function() {
    var tColor = $(this).html();
    $(this).css("color",tColor);
});

The HTML for this example

<ul id="colorList">
    <li>red</li>
    <li>green</li>
    <li>blue</li>
    <li>silver</li>
    <li>blue</li>
    <li>orange</li>
    <li>yellow</li>
    <li>blue</li>
    <li>pink</li>
</ul>

The result: