forked from marquez.juan/clase-9-eventos
Ejercicio 1
This commit is contained in:
14
index.html
14
index.html
@@ -10,6 +10,20 @@
|
||||
<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">
|
||||
|
||||
Reference in New Issue
Block a user