您好,欢迎访问一九零五行业门户网

jQuery的each终止或跳过示例代码_jquery

涉及迭代,不可避免需要有非正常终止,或强制跳过的情况。在jquery的each函数中,存在以下关系:
continue :return true;
break :return false;
直接return也会跳出jquery。
设置下拉列表选中,并终止迭代
复制代码 代码如下:
$(#area option).each(function(){
if($(this).text()==addrtmp[2]){
$(this).attr(selected, selected);//
return false;
}
});
其它类似信息

推荐信息