0

Good morning sir. When i access p in script ans set it and run html file without Window.onload function. What happens?I get eror

run script without window.onload https://code.sololearn.com/W70ybgu3J1Np/?ref=app

2nd May 2022, 7:59 AM
Malick Diagne
Malick Diagne - avatar
1 Answer
+ 2
Malick Diagne if you don't use window.onload, you will get error because your javascript code is executing before the loading of your html file. Because of this there was no <p> tag was created. So your variable paragraph was NULL, that's why it shows error because document.getElementById( ) did not found any <p> tag in the html document
2nd May 2022, 8:05 AM
NonStop CODING
NonStop CODING - avatar