Answer the question
In order to leave comments, you need to log in
How to connect JS to HTML?
Created an HTML page and added a js file to it.
I can not understand why the js file does not work (it is not highlighted in the editor). How to properly format the js file that we connect to the HTML page ???
Answer the question
In order to leave comments, you need to log in
Here is the index.html file (the name can be anything)
Here is approximately its contents:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
</body>
", then go up one line and write the following:
Done, you should get the following:<script src="main.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script src="main.js"></script>
</body>
</html>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question