First of all, you mean JavaScript.
Basically, in the first event handler, you want to delete it and then assign a new one:
function foo() { // Other work this.removeEventListner("click", foo, false); this.addEventListener("click", bar, false); } function bar() { } element.addEventListener("click", foo, false);
source share