Why I am not being able to use innerHTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why I am not being able to use innerHTML?

I tried replace contents in {{ }} with a new value. And it worked when I used console.log() to display output. But innerHTML shows some kind of error warning. Can you help me how to this scenario. https://code.sololearn.com/WmhqwMGibG14/?ref=app

5th Mar 2023, 4:01 AM
Amal Benny
Amal Benny - avatar
1 Answer
+ 6
Amal Benny you need to wrap your Javascript code inside window.onload event. This is because SoloLearn links Javascript in head section rather than body. https://code.sololearn.com/W1ThoVnicnlI/?ref=app
5th Mar 2023, 5:33 AM
Raj Chhatrala
Raj Chhatrala - avatar