Did you find this useful?
Socialize it today.

jQuery Unbind Event

Wednesday, July 04, 2012

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.



eventOne or more events to remove. Event values are separated by space
functionSpecifies optional name of the function to unbind


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. Try it yourself, by clicking the mouse icon first, then the Unbind image.

<div id="divParent">
    <img id="imgMouse"src="#" />
    <img id="imgUnbind"src="#" />
    <div id="divChild">
    <div id="divText">Click the mouse icon to toggle ....

$("#imgMouse").live("click", function () {
$("#imgUnbind").click(function () {

mouse close
Click the mouse icon to toggle this display, or click the X to unbind the event handler!

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.

Recommended Books & Training Resources

JavaScript and jQuery: The Missing Manual Professional jQuery HTML CSS and JavaScript Editor