jquery each循环,

jquery each循环,要实现break和continue的功能:
break----用return false;

continue --用return ture;

each()函数是基本上所有的框架都提供了的一个工具类函数,通过它,你可以遍历对象、数组的属性值并进行处理。jQuery和jQuery对象都实 现了该方法,对于jQuery对象,只是把each方法简单的进行了委托:把jQuery对象作为第一个参数传递给jQuery的each方法.换句话 说:jQuery提供的each方法是对参数一提供的对象的中所有的子元素逐一进行方法调用。而jQuery对象提供的each方法则是对jQuery内 部的子元素进行逐个调用。

$.each(array, [callback])遍历,很常用
var arr = ['javascript', 'php', 'java', 'c++', 'c#', 'perl', 'vb', 'html', 'css', 'objective-c'];
$.each(arr, function(key, val) {
    // firebug console
    console.log('index in arr:' + key + ", corresponding value:" + val);
    // 如果想退出循环
    // return false;
});
原文地址:https://www.cnblogs.com/zhhq/p/4071160.html