How to add JavaScript to HTML
Add a <script> tag that points to your JavaScript file, just before </body>.
<body>
...
<script src="script.js"></script>
</body>
- For a short script, you can put the code directly between
<script>and</script>instead. - Upload the HTML and JavaScript files together, in one zip.
Video Guide
Updated on: 10/11/2026
Thank you!
