- events –
- A string containing one or more event types, such as "click" or "submit" or custom event names.
- callback –
- a method that is called once just before continuing the invocation chain.
- All current iteration counts/events (from inner-most to outer-most loop) are passed as arguments.
Examples with waiting for an event
In this example the continue button should get enabled only if for each choice the user has selected some value.
The used parallel .each()..all() loop waits for each line until some radio input is selected. Any order of making choices is allowed.⇒
There is a animation cycle rotating three images. Once you move the mouse cursor over it, it pauses until the mouse is moved away.A little helper function checks whether the mouse is over the image. If that's the case a deferred jQuery object waiting for the mouseleave event is returned.
The running loop can be written in a single jQuery line.⇒