From c95ca3ed74de6d0594d6592e9dbbbb600379d21b Mon Sep 17 00:00:00 2001 From: Bruno Dalessandro Date: Sat, 23 May 2026 22:07:36 -0300 Subject: [PATCH] Ejercicio 2 --- clase-9.js | 18 +++++++++++++++++- index.html | 7 ++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/clase-9.js b/clase-9.js index 26ff756..44fecf1 100644 --- a/clase-9.js +++ b/clase-9.js @@ -26,7 +26,23 @@ boton.addEventListener("click", () => { } else { document.getElementById("descripcionCantidad").textContent = "veces."; - + } +}) + +/* + +2. Agregar un campo de texto a la página. A medida que el usuario escribe, + mostrar en tiempo real la cantidad de caracteres ingresados debajo del campo. + +*/ + +const inputTexto = document.getElementById("texto"); + +inputTexto.addEventListener("input", () => { + + let cantidad = inputTexto.value.length; + + document.getElementById("cantidadCaracteres").textContent = cantidad; }) \ No newline at end of file diff --git a/index.html b/index.html index 8abeff5..009bf60 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,12 @@
- + + +

+ Cantidad de caracteres: + 0 +