Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

jQuery unbind() Method

❮ jQuery Event Methods

Example

Remove all event handlers for all <p> elements:

$("button").click(function(){
  $("p").unbind();
});
Try it Yourself »

Definition and Usage

The unbind() method was deprecated in version 3.0. Use the off() method instead.

The unbind() method removes event handlers from selected elements.

This method can remove all or selected event handlers, or stop specified functions from running when the event occurs.

This method can also unbind event handlers using an event object. This is used to unbind an event from within itself (like removing an event handler after the event has been triggered a certain number of times).

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

Note: The unbind() method works on any event handler attached with jQuery.


Syntax

$(selector).unbind(event,function,eventObj)

Parameter Description
event Optional. Specifies one or more events to remove from the elements.
Multiple event values are separated by space.
If this is the only parameter specified, all functions bound to the specified event will be removed.
function Optional. Specifies the name of the function to unbind from the specified event for the element
eventObj Optional. Specifies the event object to remove to use. The eventObj parameter comes from the event binding function

Try it Yourself - Examples

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

Unbind an event handler using an event object
Specifies an event object to remove.


❮ jQuery Event Methods

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.