+ 1

Hi guys this code is working but only this way,that means when i seperate the script in sololearn code playground it doesn't run

<html> <head></head> <body> <h1 id="demo">hi</h1> <script> var a=document.getElementById("demo"); a.innerHTML = "hello"; </script> </body> </html>

5th Sep 2020, 12:38 PM
Djaber Meghar
Djaber Meghar - avatar
2 Answers
+ 5
Use window.onload Syntex window.onload = function (){ Your javascript code }
5th Sep 2020, 12:40 PM
Ayush Kumar
Ayush Kumar - avatar
0
Thanks it worked,thank you very much dude
5th Sep 2020, 4:25 PM
Djaber Meghar
Djaber Meghar - avatar