0
Calculator works local but not on sololears
Hello, Do somebody have a clue why my calculator works on my local computer but doesn't work on sololearn code playground? Here's a code https://code.sololearn.com/WyYkdwiTxRSC Thx in advance
2 Réponses
+ 3
sololearn loads the script first which causes lots of problems, I believe there is a document.onload function where you can do your assigning of things.
+ 3
The code in the [JS] tab is inserted into <head> and runs before <body> loads (so the document isn't ready). One way to fix this is to put everything that depends on the DOM being ready in a function that fires at the right time.
[suggested code using "window.onload = function(){ ... }" inserted as comment on code]