forked from marquez.juan/clase-9-eventos
Ejercicio 2
This commit is contained in:
12
index.html
12
index.html
@@ -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">
|
||||||
|
|||||||
Reference in New Issue
Block a user