+ 4
What is this error?
I have created a code ,which works fine in other editors but sololearn is showing error and not executing it. The error is in javascript section. https://code.sololearn.com/Waqn3JfUZ1Ws/?ref=app
4 Réponses
+ 5
visph thanks you 😊it is fixed now
+ 6
Call typing() function inside document.ready or document.onload.
You can also call your function on body tag inside onload event like this:
<body onload = "typing()">
+ 6
replace the last line of your code by:
onload = typing;
(assign the function, not the function call: don't keep the parenthesis pair)
The problem was that the js tab in code playground (same for css tab) is included in the head section of the html tab, so is executed before any page content was accessible, so you must wait for it to be loaded: onload is the document onload event handler, attached to the global window object (document.onload == window.onload)...
+ 5
visph thanks you 😊it is fixed now