DOM JS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson


I thought, i understand the DOM concept but by taking the code below i am confuse: var elem = document.getElementsById("demo"); elem.innerHTML = "Hi"; Using the "variable.innerHTML" will outputs what is in the quotes?? here for example : Hi ? When running this i get an error but i think everything is Ok! Please any suggestion to help me understand well this concept.

10th Sep 2020, 5:31 PM
Edmund Tcarters
2 Answers
+ 5
Your code is correct. You get null because SoloLearn puts scripts in head.
10th Sep 2020, 5:34 PM
Gordon - avatar
Ah okay, Thanks you
10th Sep 2020, 5:37 PM
Edmund Tcarters