.one(events ,selector ,data ,$)
Description: Attach the jQuery chain behind to one or more events. It is executed at most once per element.
- events –
- One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
- selector –
- A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
- data –
- A map of data that will be passed to the event handler.
- $ – the
- Use $ instead of a handler or leave it out.
Examples with timed version of
The buttons can be clicked one after the other. At the end the cycle starts over and over.
Remark that the code is the same no matter how many buttons we have.⇒