You can use .each() to iterate through matched elements, for example:
$("p").each(function() { alert($(this).css("background-color")); });
If you want to set or do something (for example, not getting a value from each, as mentioned above), there is no need for .each() , just execute it and it will be run for every element in the set ... this is jQuery behavior by default, for example:
$("p").show();
Nick craver
source share