49
As i searched for the solution of a problem i have right now, i found this thread: jQuery: more than one handler for same event. Now i wonder if it is possible to remove just a single one of these handlers?
As i searched for the solution of a problem i have right now, i found this thread: jQuery: more than one handler for same event. Now i wonder if it is possible to remove just a single one of these handlers?
It is possible, if you don't use anonymous callbacks:
var $elt = $(...);
function clickHandler1(event){...}
function clickHandler2(event){...}
// bind both
$elt.click(clickHandler1);
$elt.click(clickHandler2);
// unbind just the first
$elt.unbind('click', clickHandler1);
See also: .unbind() docs.