What's wrong with this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
11th Apr 2019, 12:38 PM
Piyush Kumar
Piyush Kumar - avatar
4 Answers
+ 5
This is a code from w3 schools right? Try placing the script inside the HTML tab - because to manipulate DOM with JS tab you have to wrap the whole JS code with window.onload method
11th Apr 2019, 12:51 PM
Seniru
Seniru - avatar
+ 2
script tags at head runs before the DOM exists. Move the script tags and all js code snippets to just before the closing tag of body. https://code.sololearn.com/W8qiO41gHNfu/?ref=app
11th Apr 2019, 4:05 PM
Gordon
Gordon - avatar
0
Is that correct now?
11th Apr 2019, 3:16 PM
Piyush Kumar
Piyush Kumar - avatar
0
No, it is not working.
11th Apr 2019, 4:43 PM
Piyush Kumar
Piyush Kumar - avatar