在使用jQuery的each()方法时,如何跳出循环呢?根据官方文档的说明,可以使用return false
进行break,如下:
We can break the $.each() loop at a particular iteration by making the callback function return false. Returning non-false is the same as a continue statement in a for loop; it will skip immediately to the next iteration.
示例:
function checkIsSearchForNothing() {
var result = false;
$("#searchForm").find("input[type='text']").each(function () {
if ($(this).val() != null && $(this).val() != '') {
result = true;
return false;
}
});
return result;
}
参考:
最新评论
电报上另一款AI脱衣机器人也不错, https://t.me/DoClothesOffBot?start=xbN2mc1V
怎么联系
卡卢疯子,就是他们举报大师兄被下架的,有提示的啊,你看不到吗
安卓版的安装之后 下载不了 提示要登录 并且之后3天体验