Is it possible to remove all event handlers of a given element in javascript?
- by MartyIX
Hi,
I would like to remove ALL handlers for a given event type. Let's say I've added twice "onclick event" to a button and now I would like to return back to the original state where no event handler was set to the button.
How can I do that?
P.S.: I've found removeEventListener (non-IE)/detachEvent (IE) methods but the functions want me to pass as a parameter the function that handles the event which seems to me quite clumsy because I would have to store the functions somewhere.
EDIT: http://ejohn.org/blog/flexible-javascript-events/ - I'm now using this code
Thank you!