Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery undelegate() method

jQuery undelegate() method

jQuery event methods jQuery event methods

Example

Remove all event handlers from all elements with the undelegate() method:

$("body").undelegate();

Try it »


Definition and Usage

The undelegate() method removes one or more event handlers added by delegate() method.

Since jQuery version 1.7,on() and off() method is the preferred way to add and remove event handlers on elements.


Syntax

$(

selector

).undelegate(

selector,event,function

)

Parameters Description
selector Optional. Specifies the selector whose event handlers need to be removed.
event Optional. Specifies one or more event types whose handler functions need to be removed.
function Optional. Specifies the specific event handler function to remove.

More examples

Removing all click event handlers
How to use the undelegate() method to remove all

elements.

Removing the specified function added by delegate()
How to use the undelegate() method to remove only the specified function.


jQuery event methods jQuery event methods