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 @@
Botón clickeado 0 veces.