jQuery undelegate()Method
Examples
Remove all event handlers from all elements using the undelegate() method:
$("body").undelegate();
Try it Yourself »
Definition and Usage
The undelegate() method removes one or more event handlers added by thedelegate()method.
Since jQuery version 1.7,on()andoff()the method is the preferred method for adding and removing event handlers on elements.
Syntax
$(selector).undelegate(selector,event,function)
| Parameter | Description |
|---|---|
| selector | Optional. Specifies the selector from which event handlers should be removed. |
| event | Optional. Specifies one or more event types for which handler functions should be removed. |
| function | Optional. Specifies the specific event handler function to be removed. |
More Examples
Remove all click event handlers
How to use the undelegate() method to remove all click event handlers on all <p> elements.
Remove the specified function added by delegate()
How to use the undelegate() method to remove only the specified function.
Other Extensions
jQuery Event Methods