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

DOM JS

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. https://www.sololearn.com/post/90825/?ref=app
10th Sep 2020, 5:34 PM
Gordon
Gordon - avatar
0
Ah okay, Thanks you
10th Sep 2020, 5:37 PM
Edmund Tcarters