小白教程
所有教程
关于
Search
172.71.254.21
172.71.254.21
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Misc each”的源代码
本页内容
上一节:
Misc_contains
下一节:
Misc_extend
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:$.each()}}[[Category:jquery ref misc|14]] = jQuery.each()方法 = [[jquery ref misc|jQuery 杂项方法]] 遍历数组元素 <sample title="" desc="" lang="html" hererun="1"> $(function () { $.each([52, 97], function(index, value) { alert(index + ': ' + value); }); }) </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script> </head> <body> <script> $(function () { $.each([52, 97], function(index, value) { alert(index + ': ' + value); }); }) </script> </body> </html> </run> == 定义和用法 == jQuery.each() 函数用于遍历指定的对象和数组。 == 语法 == $.each( object, callback ) {| class="table table-striped table-hover" ! 参数 ! 描述 |- | object | Object类型 指定需要遍历的对象或数组。 |- | callback | Function类型 指定的用于循环执行的函数。 |} == 更多实例 == [[try.php?filename=tryjquery_each1|遍历对象]] 遍历对象属性。 [[try.php?filename=tryjquery_each2|遍历数组]] 对数组进行遍历,并同时显示关键字及数值。 [[try.php?filename=tryjquery_each3|遍历数组]] 遍历一个数组,并同时访问迭代的元素及它的索引值。 [[try.php?filename=tryjquery_each4|遍历一个元素]] 在一个元素的属性上进行遍历,并同时访问它的关键词及值。 [[jquery ref misc|jQuery 杂项方法]]
返回至“
Misc each
”。
上一节:
Misc_contains
下一节:
Misc_extend