Why am I getting error on line -23 when clicking on the background to run change();? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why am I getting error on line -23 when clicking on the background to run change();?

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

28th Nov 2020, 4:01 PM
Jeremy Cruz
Jeremy Cruz - avatar
13 Answers
+ 2
This is because your trying to use the Dom element before the Dom element is loaded. so you should include all code in an onload event so that all your JavaScript code is Run after the window is loaded https://code.sololearn.com/W790JVp1ridD/?ref=app
28th Nov 2020, 4:20 PM
Steve Sajeev
Steve Sajeev - avatar
+ 3
Ok
29th Nov 2020, 6:59 AM
Steve Sajeev
Steve Sajeev - avatar
+ 2
Your welcome...
28th Nov 2020, 4:23 PM
Steve Sajeev
Steve Sajeev - avatar
+ 2
Can u please say what is the goal of this site so I can help you..
28th Nov 2020, 5:33 PM
Steve Sajeev
Steve Sajeev - avatar
+ 2
I would like to help you.. but when I run there are no errors. Check my code....
29th Nov 2020, 6:26 AM
Steve Sajeev
Steve Sajeev - avatar
+ 1
Thanks, I appreciate it!
28th Nov 2020, 4:21 PM
Jeremy Cruz
Jeremy Cruz - avatar
+ 1
So, I tried adding an event listener on DOMContentLoaded and also tried adding onload to body tag, but I still get the same error.
28th Nov 2020, 5:27 PM
Jeremy Cruz
Jeremy Cruz - avatar
+ 1
To have custom bangs. For example, insted of going to instagram and searching for a specific user, I just type ā€œ!ig usernameā€ and it takes me there. the same can be done with multiple sites.
28th Nov 2020, 5:40 PM
Jeremy Cruz
Jeremy Cruz - avatar
+ 1
Ok
28th Nov 2020, 5:45 PM
Steve Sajeev
Steve Sajeev - avatar
+ 1
So what is the problem that you want to fix right now. I am going offlin, back online tomorrow
28th Nov 2020, 5:46 PM
Steve Sajeev
Steve Sajeev - avatar
+ 1
Iā€™m getting an error on a negative line.
28th Nov 2020, 5:46 PM
Jeremy Cruz
Jeremy Cruz - avatar
+ 1
still happened with the onload code you sent.
28th Nov 2020, 5:46 PM
Jeremy Cruz
Jeremy Cruz - avatar
+ 1
All good, thanks. I decided to make it different. Iā€™ll just fade in.
29th Nov 2020, 6:58 AM
Jeremy Cruz
Jeremy Cruz - avatar