The Src Attribute
The src attribute allows you to point to a URL that has an external script file.
<script src="js/script.js"></script> — this points to a file called 'script.js' inside the folder 'js'.
You can also point it to an external absolute URL:
Where to place your script tag
You can place the script tag in:
- In between the
- Before the closing
There are cases where you would want to place it in the
<head> tag, and cases where you would want to place it at the bottom of the
<body> tag. This article goes more in detail about it.