0

Does anyone has this problem with their internal Javascript file working properly while the external is buggy?

I was trying to write my javascript codes in the Javascript section panel in this sololearn app. It gets unclear to me why the code in the javascript section panel refused to work BUT my javascript codes runs only when I place my code inside the <script> tag in my Html section panel. here's the link for javascript section panel https://code.sololearn.com/WnxY74Jev4dC/?ref=app here's the link for Html section panel https://code.sololearn.com/WmzX1bbMBFTP/?ref=app Please can someone tell me why the Html section panel JS works while the external JS section panel doesn't work?

7th May 2020, 9:09 AM
Stonny
Stonny - avatar
2 odpowiedzi
+ 3
Nnabuife Chidozie Chinonso When you are writing code in JS section then you should write code inside document.onlaod function. This happens because JavaScript is loading first then your Html part so you are not getting element id of text box and giving null value.
7th May 2020, 9:13 AM
A͢J
A͢J - avatar
7th May 2020, 9:13 AM
Kevin ★