Skip to content

Instantly share code, notes, and snippets.

@gavilanch
Created May 17, 2020 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavilanch/f84d782b9889ad327243f297fd29e43b to your computer and use it in GitHub Desktop.
Save gavilanch/f84d782b9889ad327243f297fd29e43b 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 = "Hello";
title.innerHTML = "The button has been clicked!";
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment