jQuery off() | Using off() method of jQuery to remove event handlers

jQuery off() method

The off() method of jQuery is used to remove event handlers attached to specified elements.  This can be used to remove event handlers attached with any method like by using on(), animate() etc.

Syntax of off() method

$(selector).off(event , event_handler )

e.g.

$(“div”).off(“click” , event_handler )

Running example of using off() method

In example below, when you click “Double click to test bind method with on() method!” an alert will be shown by using on() method. After clicking button below that text, if you again double click above text, alert will not be shown.

Experience this example online




Was this article helpful?

Related Articles

Leave A Comment?