how to remove a listener javascirpt code example

Example 1: javascript remove event listener

var someEventHander=function(event){
	console.log("do something");
}

//add listener
document.getElementById("someid").addEventListener('click',someEventHander);

//remove listener 
document.getElementById("someid").removeEventListener('click',someEventHander);

Example 2: removeEventListener

target.removeEventListener(type, listener[, options]);
target.removeEventListener(type, listener[, useCapture]);

Tags:

Java Example