Answers for "js how to to attach an event handler only once"

0

js how to to attach an event handler only once

document.getElementById("myelement").addEventListener("click", handler);

// handler function
function handler(e) {
	// remove this handler
	e.target.removeEventListener(e.type, arguments.callee);

	alert("You'll only see this once!");
}
Posted by: Guest on July-18-2020

Code answers related to "js how to to attach an event handler only once"

Code answers related to "Javascript"

Browse Popular Code Answers by Language