js remove event listener after firing code example
Example 1: javascript remove event listener
var someEventHander=function(event){
console.log("do something");
}
document.getElementById("someid").addEventListener('click',someEventHander);
document.getElementById("someid").removeEventListener('click',someEventHander);
Example 2: removeeventlistener
element.removeEventListener("mousedown", handleMouseDown)
Example 3: 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);