In this article we will learn what is .each() method in jQuery or how to use .each() method in jQuery with example.


jQuery’s .each()  function is used to loop through a collection (object type or array type). Array-like objects with a length property are iterated by their index position and value. Other objects are iterated on their key-value properties. The "JQuery .each()" function however works differently from the $(selector).each() function that works on the DOM target element using the selector. But both iterate over a jQuery object.


<!DOCTYPE html>
<html xmlns="">
    <title>Jquery Tutorials</title>
    <script src="Scripts/jquery-1.8.2.min.js"></script>
        $(document).ready(function () {
            $(document).ready(function () {
                var obj = {
                  Name: "Aditya",Language: "Jquery", Webiste: "SQL Tutorials Point"
                // each loop overe object
                $.each(obj, function (key, value) {
                    console.log(key + ": " + value);
                //each loop over element
                $("li").each(function () {

Above code snippet will iterate through every li of the page and object both output show in console window like as below:

How to iterate through each selected element of the page in jQuery

 Let's check live example

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like