why .innerHTML not working in sololearn | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why .innerHTML not working in sololearn

if i try something like: document.getElementById(id).innerHTML = 'some str' its return error. what's the problem?

30th Dec 2021, 1:03 PM
L'mk
L'mk - avatar
2 Answers
+ 2
I think because your js code runs before the actual DOM even exist. try this : window.onload = () => { // your code goes here }
30th Dec 2021, 1:16 PM
Med Amine Fh
Med Amine Fh - avatar
+ 2
What is the I'd there? Is it in proper way? Where is actual code? Showing that may help to identify..!!!!
30th Dec 2021, 1:09 PM
Jayakrishna 🇮🇳