hello, why "innerHTML " do not work , it returns an error "can't play, innerHTML" of null"" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

hello, why "innerHTML " do not work , it returns an error "can't play, innerHTML" of null""

JavaScript

28th Aug 2019, 10:57 AM
Bia
Bia - avatar
3 Answers
+ 4
Because the JavaScript runs before the DOM loaded How to solve Write your code inside onload() function Like this window.onload = function(){ //Code }
28th Aug 2019, 11:47 AM
Farhan
Farhan - avatar
0
Hello! Please could you share the code in CodePlayground and link it here so we can understand the error you are having?
28th Aug 2019, 10:59 AM
Rincewind
Rincewind - avatar
0
Thanks, I have done correction and it works very nice https://code.sololearn.com/WLAIVQWs20NM/?ref=app
28th Aug 2019, 11:51 AM
Bia
Bia - avatar