Files
clase-9-eventos/index.html
2026-06-01 21:06:57 -03:00

59 lines
2.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Clase 9 - Eventos</title>
<link rel="stylesheet" href="estilo.css">
</head>
<body>
<h1>Clase 9 - Eventos</h1>
<div id="ejercicio-1">
<!-- Agregar acá el código HTML que haga falta para el ejercicio 1 -->
<button id="boton">Clickea aca</button>
<p id="contador">Hiciste 0 clicks</p>
<script>
let contador = 0;
const miboton = document.getElementById("boton");
const parrafo = document.getElementById("contador");
boton.addEventListener("click", () => {
contador++,
parrafo.textContent = `Hiciste ${contador} clicks`;
}
)
</script>
</div>
<hr>
<div id="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>
<hr>
<div id="ejercicio-3">
<!-- Agregar acá el código HTML que haga falta para el ejercicio 3 -->
</div>
<hr>
<div id="ejercicio-4">
<!-- Agregar acá el código HTML que haga falta para el ejercicio 4 -->
</div>
<hr>
<div id="ejercicio-5">
<!-- Agregar acá el código HTML que haga falta para el ejercicio 5 -->
</div>
<script src="clase-9.js"></script>
</body>
</html>