Last active
December 9, 2018 22:20
-
-
Save Vincent-gv/af98e900afac4c3d417ccc66be28ca86 to your computer and use it in GitHub Desktop.
Compter les clics et désactiver l'événement click : https://oc-courses.github.io/javascript-web/chapitre_5/html/compteurClics.html
This file contains 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
/* | |
Exercice : compter les clics | |
*/ | |
function clic() { | |
compteurClics++; | |
document.getElementById("compteurClics").textContent = compteurClics; | |
} | |
var compteurClics = 0; | |
document.getElementById("clic").addEventListener("click", clic); | |
document.getElementById("desactiver").addEventListener("click", function () { | |
document.getElementById("clic").removeEventListener("click", clic); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment