From 4a0f14107140e11512387c9cd939a301f0883483 Mon Sep 17 00:00:00 2001 From: Nery Benincasa <42608796@terciariourquiza.edu.ar> Date: Thu, 21 May 2026 22:29:23 -0300 Subject: [PATCH] Ejercicio 1 --- clase-9.js | 15 +++++++++++++++ index.html | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/clase-9.js b/clase-9.js index 6df1007..603ed90 100644 --- a/clase-9.js +++ b/clase-9.js @@ -1 +1,16 @@ // Agregar acá el código javascript para los ejercicios + +// 1. Inicialización del estado +let contador = 0; + +// 2. Selecciono los elementos del DOM +const boton = document.getElementById('boton-contador'); +const parrafo = document.getElementById('texto-contador'); + +// 3. Registro del Event Listener utilizando una función clásica +boton.addEventListener('click', function () { + // Incremento el valor de la variable en 1 + contador++; + // Actualizo el contenido de texto del párrafo + parrafo.textContent = `Botón clickeado ${contador} veces.`; +}); \ No newline at end of file diff --git a/index.html b/index.html index 2a6b85f..4bf9034 100644 --- a/index.html +++ b/index.html @@ -10,10 +10,14 @@

Clase 9 - Eventos

+ +

Botón clickeado 0 veces.


+ +