jQuery Event - unbind() Method

Example

Remove all event handlers from all p elements:

$("button").click(function(){
  $("p").unbind();
});

Try it yourself

Definition and Usage

The unbind() method removes event handlers from the selected element.

This method can remove all or selected event handlers, or terminate the execution of the specified function when the event occurs.

unbind() is applicable to any event handler attached through jQuery.

Unbind event handlers and functions from the element

Specify one or more event handlers to be removed from the specified element.

If no parameters are specified, the unbind() method will remove all event handlers from the specified element.

Syntax

$(selector).unbind(event,function)

Try it yourself

Parameters Description
event

Optional. Specifies one or more events to be removed from the element

Multiple event values are separated by spaces.

If only this parameter is specified, all functions bound to the specified event will be removed.

function Optional. Specifies the function name to unbind from the element's specified event.

Use the Event object to unbind event handlers

Specify the event object to be removed. Used to unbind internal events to itself (for example, when the event has been triggered a certain number of times, remove the event handler).

If no parameters are specified, the unbind() method will remove all event handlers from the specified element.

Syntax

$(selector).unbind(eventObj)

Try it yourself

Parameters Description
eventObj Optional. Specifies the event object to be used. This eventObj parameter comes from the event binding function.

More examples

Unbind a specific function
How to use the unbind() method to unbind the specific function of the specified event element.