两种用法:
数组:
jQuery.each( array, callback )
对象:
jQuery.each( object, callback )
数组示例:
$.each([ 52, 97 ], function( index, value ) {
alert( index + ": " + value );
});
对象示例:
var obj = {
"flammable": "inflammable",
"duh": "no duh"
};
$.each( obj, function( key, value ) {
alert( key + ": " + value );
});
参考:
- http://api.jquery.com/jquery.each/ ;
最新评论
有了,谢谢
0527版本,Google Play Protect显示有毒。
试过很多次了
还是一样的呀