JavaScript console | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

JavaScript console

Why EventListener is not working in JS section of SoloLearn PlayGround

29th May 2018, 8:54 AM
Gopi Chand
Gopi Chand - avatar
5 Answers
+ 14
I think Hatsy Rei meant to post the link of your code with the question. Anyways, I checked your code and found the solution :D and that is "Wrap your JS code in a window.onload function" Example ~ window.onload = function (){ // all code here } Also note that you didn't define the "btn" variable for the anything so it will show errors
29th May 2018, 10:56 AM
Nikhil
Nikhil - avatar
+ 6
Post your code here so that the community can try to help you debug your stuff?
29th May 2018, 9:08 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
Thanks a lot Nikhil :)
29th May 2018, 11:26 AM
Gopi Chand
Gopi Chand - avatar
+ 1
Done
29th May 2018, 10:08 AM
Gopi Chand
Gopi Chand - avatar
0
it is not worked :(
3rd Dec 2021, 9:23 AM
Rahmatullo Qosimov