What is each() function in jQuery? How do you use it?
What is each() function in jQuery? How do you use it?
The jQuery.each()
function is a general function that will 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 element using the selector. But both iterate over a jQuery object.