+ 2

document.getElementById returns null

im not quite sure but I think my problem is that the js file is added in the head element and not on the bottom of the page so the objects I'm trying to get are still not *loaded* but that's just my guess any help how I can fix that is appreciated! thanks in advance! (I'm new to sololearn)

19th Feb 2018, 5:11 PM
Niko Harpson
Niko Harpson - avatar
1 Resposta
+ 8
In fact, in CodePlayground the scripts load inside the head of the page. The most common solution to your problem is to move the code inside the "window.onload" event, that way it will only run when the page has loaded
19th Feb 2018, 5:26 PM
Mickel
Mickel - avatar