Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery: how to remove the handler setup by .click()?

Tags:

jquery

I found sometimes I hook up 2 functions to the buttun, using .click(function(){}), is it possible for me to remove the prior attached function before I hook up new one?

like image 698
Bin Chen Avatar asked Dec 28 '22 02:12

Bin Chen


1 Answers

Not using an anonymous delegate like that. You can .unbind a named function though.

UPDATE

Actually you can call .unbind() with no arguments to remove all handlers or .unbind('click') to remove all handlers for a particular event.

like image 150
Vadim Avatar answered Jan 04 '23 21:01

Vadim