js remove event listener all code example
Example 1: javascript remove all event listeners
That is not possible without intercepting addEventListener calls and keep track of the listeners or use a library that allows such features unfortunately. It would have been if the listeners collection was accessible but the feature wasn't implemented.
The closest thing you can do is to remove all listeners by cloning the element, which will not clone the listeners collection.
Note: This will also remove listeners on element's children.
var el = document.getElementById('el-id'),
elClone = el.cloneNode(true);
el.parentNode.replaceChild(elClone, el);
Example 2: javascript remove event listener not working
var someEventHander=function(){
console.log("do something");
}
var handlerCopy=someEventHandler.bind(var1,var2)
document.getElementById("someid").addEventListener('click',handlerCopy,true);
document.getElementById("someid").removeEventListener('click',handlerCopy,true);