0
I can't use innerHTML
I tried adding innerHTML to my Java script but it said that the property can't be read. Here's my code.. https://code.sololearn.com/W7ZoQ7XXDh1p/?ref=app
5 Réponses
+ 8
That is because your script loaded before the document did. Wrap it in an onload function.
window.onload = function() {
var y = document.getElementById("demo");
y.innerHTML = "another demo text";
}
+ 3
You should check this, explain a little more why that happens:
https://www.sololearn.com/post/7444/?ref=app
0
Hatsy Rei Okay I added it to the script but the text did'nt change...
0
Asteck 1263 You have a typo there. It's window.onload not window.unload
so change u to o, then it will work
0
but how can you set intervals for the change... like wait 5 seconds before changing?