0
Why do i get errors when I separate the scripts in Code Playground?
Here is my code: https://code.sololearn.com/WRd2oe54y92G/?ref=app
3 odpowiedzi
+ 16
Try
window.onload = function delay(){
// your entire Javascript code here
}
//this is because your Javascript loads before your document & causes issues like undefined.
//hence delay your Javascript execution till doc load
+ 2
@Lord Krishna, thanks. window.onload works as well as setTimeout. But when I do that, the onclick value in html becomes undefined.
+ 1
Wow thanks..