one()The method can bind an element to any valid event, but the event that this method binds is only fired once, and its invocation format is as follows:
$(selector).one(event,[data],fun)
The parameter event is the name of the events, and data is what is carried when the event is triggered, and fun is the function that is executed when the event is triggered.
For example, using the one method binding <div> element's Click event, in the function that the event executes, the number of executions is cumulative and the number is displayed in the page as shown in:
Effects displayed in the browser:
As you can see, because the one() click event of the method binding <div> element is used, because the event function can only be executed once, the execution completes, no matter what click, no longer fires.
15. Use the One () method to bind an element's one-time event