+ 3
How to link html file to js file.(not in sololearn.)
8 Réponses
+ 8
you could place 'script' tag at any place of your html code...
the only things to be aware are:
+ if 'src' attribute is provided, any code ocurring inside it will never be executed (only the linked js file through the 'src' path provided will be loaded and executed)
+ js will load synchronously per default (parsing is stopped, until the script has been loaded and run), so if you need to access DOM inside it, you must either place it after the targeted elements or differ the execution of the DOM access...
https://code.sololearn.com/WZ52Wv4rqxXs/?ref=app
also, in sololearn (at least android) app', the JS tab is inserted at <head> start... while in sololearn website, it's inserted at <body> end ^^
+ 4
Between which tags
+ 3
Using script tag....with src attribute
+ 1
Use script tag and place the url of js file in sec attributes, and place it inside head tag (prefer to write in last line of head tag); Just like we link jQuery to our html file
+ 1
Use <link href=".js" rel="script"> or
Use <script> and write the code in between the opening and closing tags.
0
<a href="js">js<\a>