Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Linking JavaScript to an HTML File

In this mini guide, you'll learn how to link an external JavaScript file to an HTML file. By following the steps below, you can easily integrate JavaScript into your projects!


1. Create a Project Folder

  1. Create a dedicated folder on your computer for your project.
  2. Inside this folder, create the following two files:
    • index.html
    • script.js

2. Prepare the HTML File

Start your index.html file with a basic HTML structure.

Sample HTML code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Project</title>
</head>
<body>
  <!-- You can add your HTML content here -->

  <!-- The JavaScript file will be linked here -->
  <script src="script.js"></script>
</body>
</html>