How to break out of jQuery each Loop

后端 未结 7 2146
遇见更好的自我
遇见更好的自我 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 11:00

    I created a Fiddle for the answer to this question because the accepted answer is incorrect plus this is the first StackOverflow thread returned from Google regarding this question.

    To break out of a $.each you must use return false;

    Here is a Fiddle proving it:

    http://jsfiddle.net/9XqRy/

提交回复
热议问题