누군가가 removeHandler가 작동하지 않는 이유를 확인하는 데 도움을 줄 수 있습니까? 어떻게 작동 시키는가? 감사합니다. .removeEventListener가 작동하지 않는 이유
<body>
<button onclick="removeHandler()" id="myBtn">remove</button>
<p id="demo">hello</p>
<script>
document.getElementById("demo").addEventListener("click", myFunction("random: "));
function myFunction(t) {
var x = function(){
document.getElementById("demo").innerHTML = t+Math.random();
};
return x;
}
function removeHandler() {
document.getElementById("demo").removeEventListener("click", myFunction("random: "));
}
</script>
</body>
http://stackoverflow.com/questions/10444077/javascript-removeeventlistener-not-working 또는 http://stackoverflow.com/questions/16651790/javascript-removeeventlistener-not -working-event-listener-remain 또는 http://stackoverflow.com/questions/5825493/removeeventlistener-is-not-working – epascarello