-
Book Overview & Buying
-
Table Of Contents
jQuery 1.4 Reference Guide
These helper functions manipulate arrays, maps, and strings.
Iterate over a collection, firing a callback function on each item.
.each(callback)$ .each(collection, callback)
callback: A function to execute for each matched element
The jQuery object, for chaining purposes.
collection: An object or array to iterate over
callback: A function to execute for each item in the collection
The collection argument.
The .each() method and $.each() function are designed to make looping constructs concise and less error-prone. They iterate over a collection, executing a callback function once for every item in that collection.
The first syntax listed earlier is a method of jQuery objects and when called, it iterates over the DOM elements that are part of the object. Each time the callback runs, it is passed the current loop iteration, beginning from 0...
Change the font size
Change margin width
Change background colour