0
JavaScript probleme
Why document.write() is not working and also document.getElementById().innerHTML = "value"; They say some thin about innerHTML is null undefined ... I don't know if that's hapen only for me or what Thank you https://code.sololearn.com/WOyoQdj8Yapb/?ref=app
3 Answers
+ 5
You should write it like this
window.onload = function(){
document.getElementById("test").innerHTML = "ohayo";
}
Anyway it's related to the sololearn interpreter...the js code is interpreted before html so when you call document.getElementById() he can't find the Id because html hasn't been read yet.
So you put the code inside a function that gets called only when the window is loaded.
+ 1
You should link your code so that I can try to help you
0
Ah that's why it's not working
Thank youđ