Showing error with 'addEventListener' ! Please help where to fix the bug actually? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Showing error with 'addEventListener' ! Please help where to fix the bug actually?

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

6th Apr 2023, 9:19 AM
Sony
Sony - avatar
4 Answers
+ 2
window.onload=()=>{ // wrap js code }
6th Apr 2023, 9:24 AM
Jayakrishna 🇮🇳
+ 2
Reason is the js file reading before the web page load, so. You're welcome.
6th Apr 2023, 10:02 AM
Jayakrishna 🇮🇳
+ 1
I did it with the function() but it was not working though.. trying again as per your tip.. thanks
6th Apr 2023, 9:26 AM
Sony
Sony - avatar
+ 1
Forgot to mention the "=" operator before the function().. anyways thanks
6th Apr 2023, 9:29 AM
Sony
Sony - avatar