ouvinte de evento JavaScript OnClick
document.getElementById("myBtn").addEventListener("click", function() {
alert("Hello World!");
});
Batman
document.getElementById("myBtn").addEventListener("click", function() {
alert("Hello World!");
});
var element = document.getElementById("#id");
element.addEventListener('click', function(){
console.log("click");
});
const element = document.querySelector(".class__name");
element.addEventListener("click", () => {
console.log("clicked element");
});
document.querySelector("button").addEventListener("click", handle);
function handle() {
alert("I got clicked")
}
element .addEventListener( event, function, useCapture );
eventListener()