Latest web development tutorials
 

jQuery undelegate() Method

< jQuery Event Methods

Example

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

$("body").undelegate();
Try it Yourself »

Definition and Usage

The undelegate() method removes one or more event handlers, added with the delegate() method.

As of jQuery version 1.7, the on() and off() methods are preferred to attach and remove event handlers on elements.


Syntax

$(selector).undelegate(selector,event,function)

Parameter Description
selector Optional. Specifies the selector to remove event handlers from
event Optional. Specifies one or more event types to remove handler functions from
function Optional. Specifies a specific event handler function to remove

Try it Yourself - Examples

Remove all click event handlers
How to use the undelegate() method to remove all click event handlers for all <p> elements.

Remove a specific function added with delegate()
How to use the undelegate() method to remove only a specific function.


< jQuery Event Methods