From 63f8bb23a3151aa3bcb1872389dd0276d01afc24 Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Sun, 24 May 2026 14:37:45 -0300 Subject: [PATCH] ejercicio 1: contador de clicks con addEventListener --- clase-9.js | 10 +++++++++- index.html | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/clase-9.js b/clase-9.js index 6df1007..217d83c 100644 --- a/clase-9.js +++ b/clase-9.js @@ -1 +1,9 @@ -// Agregar acá el código javascript para los ejercicios +// Ejercicio 1 - Contador de clics +let clickCount = 0; +const boton = document.getElementById('miBoton'); +const parrafo = document.getElementById('contadorClicks'); + +boton.addEventListener('click', function() { + clickCount++; + parrafo.textContent = `Botón clickeado ${clickCount} veces`; +}); diff --git a/index.html b/index.html index 2a6b85f..6ba8d93 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,8 @@
Botón clickeado 0 veces