Latest web development tutorials

jQuery.each () method

jQuery Misc Methods jQuery Misc Methods

Examples

Traverse the array elements

$ (Function () {$. Each ([52, 97], function (index, value) { alert (index + ':' + value);});})

try it"

Definition and Usage

jQuery.each () function is used to traverse the specified objects and arrays.


grammar

$.each( object, callback )

参数 描述
object Object类型 指定需要遍历的对象或数组。
callback Function类型 指定的用于循环执行的函数。


Examples

More examples

Traverse the object
Traverse the object properties.

Iterate
Traverse the array, and also shows the keywords and values.

Iterate
Traversing the array, and also access to the elements and its iteration index.

Traversing element
Traverse on the property of an element, and simultaneous access to its keyword and value.


jQuery Misc Methods jQuery Misc Methods