jquery for&&each的用法

var arr=['姚明','易建联','张继科'];

each&&for用法

$.each(arr,function(index,value){
 document.write(index+''="+value+"</br>");
})
​
for(var i in arr){
  document.write(i+'</br>'); 获取数组下标
  document.write(arr[i]+'</br>');
}
-----------对于对象遍历的使用--------
var object={name:'姚明',sex:'man'};
​
$.each(object,function(key,value){
  document.write(key+'='+value+'</br>');
})
<div class="event_list">
  <div>
    <div>
       <li></li>
       <li></li>
    </div>
  </div>
</div>
---------------------------------
$('.event_list div div li').each(function(){
  $(this).bind('click',function(){
  });
});
原文地址:https://www.cnblogs.com/ssgao/p/8868626.html