How to break out of jQuery each Loop

后端 未结 7 1966
遇见更好的自我
遇见更好的自我 2020-11-22 10:04

How do I break out of a jQuery each loop?

I have tried:

 return false;

In the loop but this did not work. Any ideas?

7条回答
  •  情深已故
    2020-11-22 10:40

    "each" uses callback function. Callback function execute irrespective of the calling function,so it is not possible to return to calling function from callback function.

    use for loop if you have to stop the loop execution based on some condition and remain in to the same function.

提交回复
热议问题