Agrega ejercicio 2 de la clase 9

This commit is contained in:
Lucio Gaibazzi
2026-05-30 20:59:27 -03:00
parent 94cb1595d1
commit f8ec466ac7
2 changed files with 13 additions and 0 deletions

View File

@@ -10,3 +10,14 @@ boton.addEventListener("click", function(){
clicks++; clicks++;
parrafo.textContent = `Botón clickeado ${clicks} veces`; 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}`;
});

View File

@@ -16,6 +16,8 @@
<hr> <hr>
<div id="ejercicio-2"> <div id="ejercicio-2">
<!-- Agregar acá el código HTML que haga falta para el ejercicio 2 --> <!-- Agregar acá el código HTML que haga falta para el ejercicio 2 -->
<input type="text" id="texto">
<p id="cantidadCaracteres">Cantidad de caracteres: 0</p>
</div> </div>
<hr> <hr>
<div id="ejercicio-3"> <div id="ejercicio-3">