1.与for的性能相比each不如forjquery
2.jquery的$().each,$.each的区别数组
$().each,对于这个方法,在dom处理上面用的较多。例如:dom
$(“input[name=’ch’]”).each(function(i){性能
if($(this).attr(‘checked’)==true){this
//一些操做代码索引
}input
}源码
对于遍历一个数组,用$.each()来处理,简直爽到了极点。例如:io
$.each([{“name”:”limeng”,”email”:”xfjylimeng”},{“name”:”hehe”,”email”:”xfjylimeng”},function(i,n){function
alert(“索引:”+i,”对应值为:”+n.name);
});
3.each的源码