0

Could you help me? I need to know what happens in this example to not use onclick in html

https://code.sololearn.com/WWCUPPTHa7bt/?ref=app

1st Dec 2020, 4:28 PM
Geovanny González
Geovanny González - avatar
3 odpowiedzi
+ 7
Use it . window.onload=function(){ var muestra = document.querySelector(".boton"); muestra.addEventListener("click", function(){ alert("bien hecho"); }); }
1st Dec 2020, 4:31 PM
TOLUENE
TOLUENE - avatar
0
Excellent! Thanks a lot.
1st Dec 2020, 5:39 PM
Geovanny González
Geovanny González - avatar
0
it's better this way, right? window.addEventListener("load", function(){ var muestra = document.querySelector(".boton"); muestra.addEventListener("click", function(){ alert("bien hecho"); }); });
1st Dec 2020, 6:30 PM
Geovanny González
Geovanny González - avatar