jquery 中跳出each循环

来源:互联网 发布:记忆曲线软件 编辑:程序博客网 时间:2024/06/05 05:35

转自:http://hi.baidu.com/bing2liuliu/item/67ab56f92986a16f3c1485ae

jquery 中跳出each循环

$("#poll_container dl dt").each(
function (i)
{
if ($(this).html() == $(pobj).find("dt").html())
{
alert($(pobj).find("dt").html() + '#'+i);
return false;//使用break会报错
}
}
);

用return false 会跳出这个循环

不影响后面的代码执行

另外continue 用return true;代替

0 0
原创粉丝点击