+ 2

What is the error with this code? I want to display Hello World when the button is clicked,but cannot.

HTML,JS https://code.sololearn.com/W6U05z3LhbB3/?ref=app 【SOLVED】

27th Dec 2021, 1:06 PM
Sujit Kr Singh
Sujit Kr Singh - avatar
4 Respuestas
+ 2
Actually JavaScript gets loaded before Html thats why error is there To solve this U can use window.onload function Learn more about this : https://www.w3schools.com/jsref/event_onload.asp https://code.sololearn.com/W3CU1Fd75sg8/?ref=app
27th Dec 2021, 1:14 PM
Atul
Atul - avatar
+ 2
Thank you very much Inumaki👍
27th Dec 2021, 1:17 PM
Sujit Kr Singh
Sujit Kr Singh - avatar
+ 1
Thanks brother.👍
27th Dec 2021, 1:18 PM
Sujit Kr Singh
Sujit Kr Singh - avatar