0

The js file

How can I put the js file in the body element wherever I want, for example after the div before dive or in the div in sololearn app? I know I can access the div by referring the the tag or I can even create another script in the body, but I want to move the external js that is provided to move it anywhere I want.

25th May 2023, 1:36 PM
Yahya Hassan
Yahya Hassan - avatar
6 odpowiedzi
25th May 2023, 1:40 PM
Lisa
Lisa - avatar
+ 1
You can write JS in the html tab. The JS tab is automatically linked to the html tab
25th May 2023, 1:59 PM
Lisa
Lisa - avatar
0
Lisa I know how to add script tag I'm talking about how can I move the js that is provided in sololearn to move it anywhere I want in the body tag in sololearn app?
25th May 2023, 1:44 PM
Yahya Hassan
Yahya Hassan - avatar
0
Lisa yes I have tried that and it worked but I was looking for a way I can alter the linked JS to work where I want in the body without creating another <script> tag. But I think is not possible in the app right?
25th May 2023, 2:20 PM
Yahya Hassan
Yahya Hassan - avatar
0
No, we don't have influence on when/where the JS tab is linked. If your code requires that the body is completely loaded, you can wrap your code in window.onload = () => { // your code }
25th May 2023, 2:30 PM
Lisa
Lisa - avatar
0
Yes correct thanks Lisa.
26th May 2023, 3:31 AM
Yahya Hassan
Yahya Hassan - avatar