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
1 Respuesta
+ 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