Misc Each
# jQuery Miscellaneous each() Method
[ jQuery Miscellaneous Methods](#)
## Example
Output the text of each `` element:
$("button").click(function(){
$("li").each(function(){
alert($(this).text());
});
});
[Try it yourself Β»](#)
* * *
## Definition and Usage
The `each()` method specifies a function to run for each matched element.
**Tip:** Returning `false` can be used to stop the loop early.
* * *
## Syntax
$(_selector_).each(function _(index,element)_)
| Parameter | Description |
| :--- | :--- |
| function _(index,element)_ | Required. The function to run for each matched element. * _index_ - The index position of the selector. * _element_ - The current element (can also use the "this" selector). |
* * jQuery Miscellaneous Methods](#)
YouTip