jQuery undelegate()Method

jQuery 事件方法jQuery Event Methods

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.


jQuery 事件方法jQuery Event Methods

Other Extensions