Skip to content

Instantly share code, notes, and snippets.

@gavilanch
Last active May 9, 2020 13:08
Show Gist options
  • Select an option

  • Save gavilanch/ee7ace8894e15088fec956d0f3431167 to your computer and use it in GitHub Desktop.

Select an option

Save gavilanch/ee7ace8894e15088fec956d0f3431167 to your computer and use it in GitHub Desktop.
function initializeCounterComponent(container) {
var boton = container.querySelector("#counterClick");
var title = container.querySelector("h1");
if (boton) {
boton.addEventListener("click", (e) => {
console.log("click JavaScript");
let button = e.target;
button.innerHTML = "Hola";
title.innerHTML = "El botón ha sido clickeado!";
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment