Compare commits
2 Commits
main
...
ejercicios
| Author | SHA1 | Date | |
|---|---|---|---|
| 61ce091c00 | |||
| 83b512ab94 |
26
index.html
26
index.html
@@ -10,10 +10,36 @@
|
|||||||
<h1>Clase 9 - Eventos</h1>
|
<h1>Clase 9 - Eventos</h1>
|
||||||
<div id="ejercicio-1">
|
<div id="ejercicio-1">
|
||||||
<!-- Agregar acá el código HTML que haga falta para el 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>
|
</div>
|
||||||
<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