2 Answers
+ 2
C#Coder First thing class name should not have dot(.) 2nd thing write code inside window.onload function window.onload = function() { const button = document.querySelector(".button"); button.onclick = function () { alert("hello!"); } }
8th Aug 2022, 3:12 PM
AÍąJ
AÍąJ - avatar
0
Thanks
8th Aug 2022, 5:45 PM
C#Coder
C#Coder - avatar