feat: add click counter button interaction

This commit is contained in:
2026-05-20 15:44:02 -03:00
parent ddefc238dc
commit 0b8e8b5bd7
2 changed files with 14 additions and 1 deletions

View File

@@ -1 +1,13 @@
// Agregar acá el código javascript para los ejercicios // Agregar acá el código javascript para los ejercicios
// Ejercicio 1
const clickCounter = document.getElementById('clickCounter');
const clickButton = document.getElementById('clickButton');
let count = 0;
clickButton.addEventListener('click', () => {
count++;
clickCounter.textContent = count;
});

View File

@@ -9,7 +9,8 @@
<body> <body>
<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 --> <p> Este boton ha sido clickeado <span id="clickCounter">0</span> veces</p>
<button id="clickButton">Clickeame!</button>
</div> </div>
<hr> <hr>
<div id="ejercicio-2"> <div id="ejercicio-2">