The jQuery event unbind() method removes event handles from selected elements. This method can remove all or selected event handlers, or stop specified functions from running when the event occurs.

Using the unbind method with no arguments, will remove all handlers attached to the element(s). As of jQuery 1.7, the .on() and .off() methods are the preferred methods to attach and remove event handlers on elements.

Syntax

$(selector).unbind(event,function)

Example

In the following jQuery example, the unbind() method removes the click event from the element with an id of imgMouse. When the imgUnbind element is clicked, the slideToggle effect is removed from click event attached to the imgMouse element.

In this example, the div element will be shown or hidden as the mouse icon is clicked. Clicking the Unbind image removes this event.

Click the mouse icon to toggle ....

$("#imgMouse").live(“click”, function () { $("#divChild").slideToggle(); });

$("#imgUnbind").click(function () { $("#imgMouse").unbind(); });