js how to to attach an event handler only once code example
Example: 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!");
}