+ 1
why is addEventListener in Javascript not available in solo learn?
addEventListener is not working on my code in javascript https://code.sololearn.com/WlWcn4rRrAN9/?ref=app
3 Respuestas
+ 3
Write your JavaScript inside this then it will work
window.onload=()=>{ // JavaScript here };
+ 6
The problem is not exactly the addEventListener but that the variable that should hold the button is null at the time you try to add the listener.
One solution could be, to put your js inside
onload = () => {
here goes your js...
}
+ 2
thanks guys it works!