From e2d03163cb5ab4c19f51fafbbafc6428715cfb09 Mon Sep 17 00:00:00 2001 From: Sergio Madera De Marco <37299705@terciariourquiza.edu.ar> Date: Sun, 24 May 2026 14:44:53 -0300 Subject: [PATCH] ejercicio 2: contador de caracteres en tiempo real --- clase-9.js | 8 ++++++++ index.html | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/clase-9.js b/clase-9.js index 217d83c..4b40054 100644 --- a/clase-9.js +++ b/clase-9.js @@ -7,3 +7,11 @@ boton.addEventListener('click', function() { clickCount++; parrafo.textContent = `Botón clickeado ${clickCount} veces`; }); + +// Ejercicio 2 - Contador de caracteres en tiempo real +const campoTexto = document.getElementById('campoTexto'); +const contadorCaracteres = document.getElementById('contadorCaracteres'); + +campoTexto.addEventListener('input', function() { + contadorCaracteres.textContent = `Caracteres ingresados: ${campoTexto.value.length}`; +}); diff --git a/index.html b/index.html index 6ba8d93..389860b 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,9 @@
Caracteres ingresados: 0