jquery的$.each如何退出循环和退出本次循环

https://api.jquery.com/jQuery.each/

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.

 

 

jQuery中each类似于javascript的for循环 
但不同于for循环的是在each里面不能使用break结束循环,也不能使用continue来结束本次循环,想要实现类似的功能就只能用return,
break           用return false
continue      用return true

 

posted on 2018-11-28 11:32  小甜瓜安东泥  阅读(721)  评论(0编辑  收藏  举报