From f8ec466ac7d388c0a9678eb4b8fbde7a5419cd8b Mon Sep 17 00:00:00 2001 From: Lucio Gaibazzi Date: Sat, 30 May 2026 20:59:27 -0300 Subject: [PATCH] Agrega ejercicio 2 de la clase 9 --- clase-9.js | 11 +++++++++++ index.html | 2 ++ 2 files changed, 13 insertions(+) diff --git a/clase-9.js b/clase-9.js index 83dca61..2420256 100644 --- a/clase-9.js +++ b/clase-9.js @@ -9,4 +9,15 @@ const parrafo = document.querySelector("#textoContador"); boton.addEventListener("click", function(){ clicks++; parrafo.textContent = `Botón clickeado ${clicks} veces`; +}); + + + +//Ejercicio 2 de la clase 9 + +const campo = document.querySelector("#texto"); +const contadorCaracteres = document.querySelector("#cantidadCaracteres"); + +campo.addEventListener("input", function() { + contadorCaracteres.textContent = `Cantidad de caracteres: ${campo.value.length}`; }); \ No newline at end of file diff --git a/index.html b/index.html index 003ccda..22e35d3 100644 --- a/index.html +++ b/index.html @@ -16,6 +16,8 @@
+ +

Cantidad de caracteres: 0