Created
March 31, 2018 22:59
-
-
Save theHamdiz/85d3683c7d52ad6b07f472ee1d6175ab to your computer and use it in GitHub Desktop.
Add dynamic event listener and remove it on the fly in js.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dynamic = document.getElementById('dynamic'); | |
dynamic.addEventListener('click', dynamic_click); | |
function dynamic_click() { | |
alert(Math.random()); | |
dynamic.removeEventListener('click', dynamic_click); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment