forked from marquez.juan/clase-9-eventos
Agregue un boton y un parrafo que dice cuantas veces se clickeo
This commit is contained in:
@@ -1 +1,10 @@
|
|||||||
// Agregar acá el código javascript para los ejercicios
|
// Agregar acá el código javascript para los ejercicios
|
||||||
|
const boton = document.querySelector("button");
|
||||||
|
const parrafo = document.querySelector("p");
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
boton.addEventListener("click", function () {
|
||||||
|
i = i + 1
|
||||||
|
parrafo.textContent = `Este boton ha sido clickeado ${i} veces`;
|
||||||
|
console.log(`El botón fue clickeado ${i} veces`);
|
||||||
|
});
|
||||||
@@ -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 -->
|
<button>Haz click</button><!-- Agregar acá el código HTML que haga falta para el ejercicio 1 -->
|
||||||
|
<p>Este boton ha sido clickeado 0 veces</p>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div id="ejercicio-2">
|
<div id="ejercicio-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user