Home >>jQuery Tutorial >jQuery each() Method

jQuery each() Method

jQuery each() Method

jQuery each() method in jQuery is used to specifies a function to run for each matched element.


Parameter Values

Parameter Description
function(index,element) It is a required parameter which is used to run a function for each matched element.
  • index – Used to the index position of the selector
  • element – Used to the current
Here is an Example of jQuery each() Method:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<button class="btn1">Click me to alert the value of each list item</button>

  • One
  • Two
  • Three

No Sidebar ads