+ 2

Help with dom model

https://code.sololearn.com/Wg85IOl4FL7W/?ref=app Console is showing null value. Can anyone tell me what I am doing wrong and how to get "game test" to show in the console?

20th Sep 2019, 11:43 AM
foofghtr7
3 Answers
+ 2
Copy this to your JS file. And follow me pls👌 window.onload = function() { var game = document.getElementById("test"); game.innerHTML = "game test"; console.log(game.innerHTML); }
20th Sep 2019, 11:48 AM
KfirWe
KfirWe - avatar
+ 1
the js run before the page are loaded. here is the fix https://code.sololearn.com/WMjglSL3lMeq/?ref=app
20th Sep 2019, 11:44 AM
Taste
Taste - avatar
+ 1
Good day foofghtr7! Others have pointed out the issue and I believe you would be interested with this. 😉 https://code.sololearn.com/WXe61FrE4YD4
20th Sep 2019, 1:09 PM
Zephyr Koo
Zephyr Koo - avatar