ouvinte de evento JavaScript OnClick
document.getElementById("myBtn").addEventListener("click", function() {
alert("Hello World!");
});
Batman
document.getElementById("myBtn").addEventListener("click", function() {
alert("Hello World!");
});
const element = document.querySelector(".class__name");
element.addEventListener("click", () => {
console.log("clicked element");
});
document.querySelector('div').addEventListener('click', () => {
console.log('div clicked');
});
element.addEventListener("click", function(){
element.innerText = "something";
});
function first(){
alert( " hi it's Toofi");
}
task3Element.addEventListener('click', first);
document.querySelector("button").addEventListener("click", handle);
function handle() {
alert("I got clicked")
}