jQuery one() Method (original) (raw)
Last Updated : 11 Jul, 2025
The **jQuery one() method is an inbuilt method that attaches one or more event handlers for the selected element. This also attaches a function to run when the event occurs. This method is named one because whatever event handler attaches to this method will run only once.
**Syntax:
$(selector).one(event, data, function)
**Parameter:
This method accepts three parameters as mentioned above and described below:
- **event: It is a required parameter. It is used to specify one or more events to attach to the elements. If multiple events given then use space to separate them.
- **data: It is an optional parameter. It is used to specify additional data to pass along to the function.
- **function: It is a required parameter. It is used to specify the function to run when the event occurs.
**Return Value:
This method returns the selected element with the specified event handler.
**Example 1: This example illustrates the use of one() method.
HTML `