0

What's wrong with my code?why is it showing "cannot set properties of null ?

Please check and help https://code.sololearn.com/W2QZeSlLzQ1c/?ref=app

29th Oct 2023, 5:13 AM
Akanksha Raundal
Akanksha Raundal - avatar
6 Réponses
+ 2
Akanksha Raundal You can put all your JavaScript code inside the yourCode function. Also you can name yourCode function to any name you want.
29th Oct 2023, 9:59 AM
Mafdi
Mafdi - avatar
+ 6
// Scroll Reveal distance in px is not responsive. Better way as follows: const sr = ScrollReveal ({ origin: 'top', distance: '4rem', duration: 2000, reset: true });
29th Oct 2023, 5:35 AM
JaScript
JaScript - avatar
+ 5
window.onload = yourCode; function yourCode() { // Your code goes here } Making sure to load html elements first, then interacting with them in JavaScript, otherwise they return null as if they don't exist.
29th Oct 2023, 5:26 AM
Mafdi
Mafdi - avatar
+ 4
Akanksha Raundal here I have the question answered why happed that and how is the solution: https://sololearn.com/discuss/3248907/?ref=app
29th Oct 2023, 1:09 PM
JaScript
JaScript - avatar
0
Can you both please apply your edits in the code ? Pleased cuz I am not able to understand where to put those codes. Please 🙏
29th Oct 2023, 8:31 AM
Akanksha Raundal
Akanksha Raundal - avatar
0
TYSM!
29th Oct 2023, 10:03 AM
Akanksha Raundal
Akanksha Raundal - avatar