Skip to content

Instantly share code, notes, and snippets.

@Vincent-gv
Last active December 9, 2018 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vincent-gv/af98e900afac4c3d417ccc66be28ca86 to your computer and use it in GitHub Desktop.
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
/*
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