jQuery one() method
Example
When the
element is clicked, increase the element's text size (the event can only be
triggered once per element):
$("p").one("click",function(){
$(this).animate({fontSize:"+=6px"});
});
Try it »
Definition and Usage
The one() method adds one or more event handlers to the selected elements, and specifies a function to run when the event occurs.
When using the one() method, each element can run theonceevent handler function.
Syntax
$(
selector
).one(
event,data,function
)
| Parameters | Description |
|---|---|
| event | Required. Specifies one or more events to add to the element. |
由空格分隔多个事件值。必须是有效的事件。 |
| data | Optional. Specifies additional data passed to the function. | | function | Required. Specifies the function to run when the event occurs. |
jQuery event methods