forked from marquez.juan/clase-9-eventos
Agrega ejercicio 1 de la clase 9
This commit is contained in:
11
clase-9.js
11
clase-9.js
@@ -1 +1,12 @@
|
|||||||
// Agregar acá el código javascript para los ejercicios
|
// Agregar acá el código javascript para los ejercicios
|
||||||
|
|
||||||
|
//Ejercicio 1 de la clase 9
|
||||||
|
|
||||||
|
let clicks = 0;
|
||||||
|
const boton = document.querySelector("#botonEjc1");
|
||||||
|
const parrafo = document.querySelector("#textoContador");
|
||||||
|
|
||||||
|
boton.addEventListener("click", function(){
|
||||||
|
clicks++;
|
||||||
|
parrafo.textContent = `Botón clickeado ${clicks} veces`;
|
||||||
|
});
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
<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="botonEjc1">Click</button>
|
||||||
|
<p id="textoContador">Botón clickeado 0 veces</p>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div id="ejercicio-2">
|
<div id="ejercicio-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user