ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## .each() 语法: ``` jQuery.each( collection, callback(indexInArray, valueOfElement) ) ``` ### 遍历数组 ``` $.each([52, 97], function(index, value) { alert(index + ': ' + value); }); ``` ### 遍历对象 ``` var obj = { "flammable": "inflammable", "duh": "no duh" }; $.each( obj, function( key, value ) { alert( key + ": " + value ); }); ```