【发布时间】:2015-05-18 16:44:36
【问题描述】:
我想将搜索结果分解为多个块。我在 .each() 循环中显示 10 个结果集,然后在结果计数为 10 时中断循环。如果用户单击某个结果,则应显示更多结果,直到显示 20 个结果,依此类推。按下按钮时,循环正确停止,但不会继续(即显示更多结果)。我哪里做错了?
$("Document").each(function(index) {
//code to display search result (not included)
if ( index % 10 === 0) {
//stop the loop
return false;
$("button#moreResults").click(function(event){
//continue the loop of the each function
return;
});
}
});//end of each function
【问题讨论】:
标签: jquery loops search return break