jquery

.each() jQuery

var all_divs = $("div");

all_divs.each(function(index, item) {
   //DO SOMETHING HERE
})

.each() function in jQuery is used for looping through elements. In the code snippet, we have selected all 'div' elements which must be existed on the webpage. .each() function can be used here to manipulate all div elements.

Was this helpful?