I have a DOM element with an event handler attached using addEventListener
. By the time I want to remove it with removeEventListener
, I no longer have a reference to the function that handles the event.
How can I remove the event listener, other than storing references to all event handlers globally?
I noticed that if I edit the DOM element using the Chrome developer tools, the event is no longer handled. Could a viable solution lie herein?
I'm not using and unable to use a library like jQuery in this particular situation.