From b97fb32d679f8d75ad7fa00fd1936a3da635cf8d Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Wed, 20 May 2026 16:03:21 -0300 Subject: [PATCH] feat: add character count functionality to text input --- clase-9.js | 9 +++++++ index.html | 74 +++++++++++++++++++++++++++++++----------------------- 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/clase-9.js b/clase-9.js index a3d6541..1ce769c 100644 --- a/clase-9.js +++ b/clase-9.js @@ -11,3 +11,12 @@ clickButton.addEventListener('click', () => { count++; clickCounter.textContent = count; }); + +// Ejercicio 2 + +const textInput = document.getElementById('textInput'); +const charCount = document.getElementById('charCount'); + +textInput.addEventListener('input', () => { + charCount.textContent = textInput.value.length; +}); diff --git a/index.html b/index.html index 517f21e..c8b10b9 100644 --- a/index.html +++ b/index.html @@ -1,33 +1,45 @@ - - - - Clase 9 - Eventos - - - -

Clase 9 - Eventos

-
-

Este boton ha sido clickeado 0 veces

- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
- - - + + + + + Clase 9 - Eventos + + + + +

Clase 9 - Eventos

+
+

Este boton ha sido clickeado 0 veces

+ +
+
+
+ + + + +

+ Caracteres ingresados: + 0 +

+
+
+
+ +
+
+
+ +
+
+
+ +
+ + + + \ No newline at end of file