Code working in solo learn but not IE | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Code working in solo learn but not IE

So ive been working on a code on vs code and when its ran it doesnt working and returns the following error: script.js:53 Uncaught TypeError: Cannot set properties of null (setting 'innerHTML') at calculateCashPerSec (script.js:53:53) at productPurchase (script.js:85:9) at script.js:134:1 However the code works fine in the sololearn enivroment. In my vs project, it does have the CSS and JS files linked correctly, any ideas> also i cant find the add code button on desktop, so heres the link: https://www.sololearn.com/compiler-playground/WJRxRMvP9dm0

26th Oct 2023, 10:10 PM
Callum Stewart
Callum Stewart - avatar
6 Answers
28th Oct 2023, 10:19 AM
Chris Coder
Chris Coder - avatar
+ 1
Code working in solo learn but not IE So ive been working on a code on vs code and when its ran it doesnt working and returns the following error: script.js:53 Uncaught TypeError: Cannot set properties of null (setting 'innerHTML') at calculateCashPerSec (script.js:53:53) at productPurchase (script.js:85:9) at script.js:134:1 However the code works fine in the sololearn enivroment. In my vs project, it does have the CSS and JS files linked correctly, any ideas> also i cant find the add code button on desktop, so heres the link: https://www.sololearn.com/compiler-playground/WJRxRMvP9dm0
26th Oct 2023, 10:56 PM
Aezakmi Aezakmi
Aezakmi Aezakmi - avatar
27th Oct 2023, 12:39 AM
Mafdi
Mafdi - avatar
+ 1
window.addEventListener("load", () => { // Your code goes here }); getElementById returns null if there is no element with that id, or the html needs to load first, so with this event, you execute your Javascript after html loading. https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
27th Oct 2023, 12:54 AM
Mafdi
Mafdi - avatar
+ 1
Are you testing in (IE) Internet Explorer, the dead browser? its 2023, im not sure if you should be doing that unless some1 is going to hire you especifically to write code for that.
27th Oct 2023, 2:24 AM
Arturop
Arturop - avatar
0
So I just tested this on the phone app and it's giving me the same error.
26th Oct 2023, 10:16 PM
Callum Stewart
Callum Stewart - avatar