WIP Eventos #4

Open
dalessandro.bruno wants to merge 5 commits from dalessandro.bruno/clase-9-eventos:ejercicios-eventos into main
2 changed files with 23 additions and 2 deletions
Showing only changes of commit c95ca3ed74 - Show all commits

View File

@@ -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;
})

View File

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