As Leeoniya notes: $(input:text).each(function(){ if(something happened) { return false; } })
On Apr 14, 8:59 pm, Leeoniya <leeon...@gmail.com> wrote: > wait, you should be doing "return FALSE" rather than just "return" > > On Apr 14, 7:57 pm, Leeoniya <leeon...@gmail.com> wrote: > > > well according tohttp://docs.jquery.com/Core/each > > returning false SHOULD break out of the loop, haven't tried it tho - i > > can't imagine something like this would be broken at this point, maybe > > your condition is never being met? > > > On Apr 14, 7:51 pm, Leeoniya <leeon...@gmail.com> wrote: > > > > i, too, am curious how to break out of a .each() loop. > > > > On Apr 14, 7:35 pm, jack <datac...@gmail.com> wrote: > > > > > Hi, all > > > > > See the following. > > > > > $(input:text).each(function(){ > > > > ---- > > > > if(something happened) return; > > > > --- > > > > --- > > > > > }) > > > > > I found the 'return' only exit form a particular input element. And it > > > > won't return from "each" function. It always go through every > > > > element. I mean if something happened I don't want to go any further > > > > elements and just exit from "each" function. Is there any way to do > > > > that? Thank you in advance!