Help With innerHTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help With innerHTML

The code playground is returning a script error when I am trying to use JS to replace the innterHTML of div „countNum“. What have I done wrong? https://code.sololearn.com/W9cSA9bNHTVC/?ref=app

12th Nov 2018, 1:07 PM
chrisHartman
4 Answers
+ 3
This question has been asked multiple times. Wait sometime
12th Nov 2018, 1:09 PM
Roneel
Roneel - avatar
+ 1
KrOW Thank you for the reply, but I am still not clear on how that applies to my code problem. Are you suggesting that I use the “window.onload” somewhere instead of the simple “document.getElementById”? Or should I be writing my code in the HTML tab as a script at the end of the body element? Please help me to understand how this script execution applies to my specific code.
12th Nov 2018, 2:03 PM
chrisHartman
12th Nov 2018, 1:41 PM
KrOW
KrOW - avatar
0
My code would make you a better understanding of how js is loaded and when you can access to dom elments... Try to read the html/js code (dont worry about function printInfo is only for print info in console) and follow execution on console
12th Nov 2018, 2:14 PM
KrOW
KrOW - avatar