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

26th Aug 2017, 8:08 PM
Maciej Mazurek
Maciej Mazurek - avatar
2 Antworten
+ 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.
26th Aug 2017, 9:05 PM
Jordan Chapman
Jordan Chapman - avatar
+ 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]
26th Aug 2017, 9:06 PM
Kirk Schafer
Kirk Schafer - avatar