Ejercicio 2

This commit is contained in:
2026-06-01 21:06:57 -03:00
parent 83b512ab94
commit 61ce091c00

View File

@@ -28,6 +28,18 @@
<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 -->
<label for="texto">Ingrese sus caracteres </label>
<input type="text" id="miTexto" name="miTexto" rows="4" cols="50" placeholder="Ingrese algo aqui...">
<p id="contador2">Ingresaste 0 cantidad de caracteres</p>
<script>
const campo = document.querySelector("input");
const parrafo2 = document.getElementById("contador2");
campo.addEventListener("input", () => {
const cantidadCaracteres = campo.value.length;
parrafo2.textContent = `Ingresaste esta cantidad ${cantidadCaracteres} de caracteres`;
})
</script>
</div> </div>
<hr> <hr>
<div id="ejercicio-3"> <div id="ejercicio-3">