Created
January 31, 2019 18:38
-
-
Save parzibyte/c9a6c6a9f3c7673ccdc25677233a55c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Obtener referencia a botón | |
// Recuerda: el numeral o # indica id | |
const boton = document.querySelector("#miBoton"); | |
// Agregar listener | |
boton.addEventListener("click", function (evento) { | |
// Aquí todo el código que se ejecuta cuando se da click al botón | |
// El evento del click | |
console.log("El evento es: ", evento); | |
// Para acceder al botón usamos this | |
// Por ejemplo cambiemos el texto | |
this.innerText = "Se cambia"; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment