The each method
The each method calls the given function for each element of the set. Unlike the similar map method, which returns a newly formed set of different elements and objects, the each method returns the original set of elements.
Syntax
The elements themselves are available in the function, in the variable this, and their ordinal numbers in the set — in the variable index:
$(selector).each(function(index, elem));
Example
Let's display the contents of each paragraph sequentially using the each and text methods:
<p>text1</p>
<p>text2</p>
<p>text3</p>
$('.www').each(
function() {
console.log($(this).text()); // will bring out 'text1', 'text2' And and 'text3'
}
);