Interviews - C# Corner

Nitin Choudhary
What is the use of each function in jQuery?
By Nitin Choudhary in JQuery onJan 20 2015
  • Bidyasagar Mishra
    Jul, 2019 12

    it act as like as for loop . it works untill length of the object has not finished

    • 0
  • Vaibhav Salwe
    May, 2015 30

    In short way each is loop using we can travel selected container.$.each(selector, function( index, value ) {});

    • 0
    Mar, 2015 27

    Each function is similar to foreach.if you get any array format value from resultset.we simply use each function in jquery. like jquery("#resultset").each(function(rs){ alert(rs[0].toString()); });

    • 0
  • Navin Kumar
    Feb, 2015 27

    Each function is similar to loop in any language . It select all the element selected by selector and iterate one by one.

    • 0
  • keyur
    Feb, 2015 10

    Each function is same as for loop in you can iterate through all the elements . Like if you have want to loop through all tables tr then you can do like$("table tr").each(function({// code here});

    • 0
  • Md. Raskinur Rashid
    Jan, 2015 28

    Description: A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.Note: The $.each() function internally retrieves and uses the length property of the passed collection. So, if the collection has a property called length — e.g. {bar: 'foo', length: 10} — the function might not work as expected.1 2 3 $.each([ 52, 97 ], function( index, value ) {alert( index + ": " + value ); }); This produces two messages:0: 52 1: 97

    • 0
  • Nitin Choudhary
    Jan, 2015 20

    Each function is used to iterate each and every element of an object. It is used to loop DOM elements, arrays and the object properties.

    • 0

Most Popular Companies

Most Popular Job Functions