0
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Indus</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div id="game">
        <div id="character"></div>
    </div>
    <script src="script.js">
</body>
</html>

I'm using Atom for this. For some reason the </body> and </html> is grayed out and the rest being properly colored. This is stopping my program from running properly (obviously)

leonheess
  • 10,362
  • 9
  • 56
  • 89
clonts
  • 95
  • 6

1 Answers1

1

You need a closing script tag

<script src="script.js"></script>

Script tag always need to be closed even if your tag is just referencing a file, opposed to surrounding actual Javascript.

Uuuuuumm
  • 504
  • 4
  • 18
  • since it is an external script this wouldn't be necessary – blankettripod Nov 09 '20 at 20:49
  • I've never know it to be different for external scripts, but I could be wrong. I know HTML will still function if you have invalid HTML depending on where/what the errors are. – Uuuuuumm Nov 09 '20 at 20:51
  • I've tried that, but I took it off because it completely grays out everything. – clonts Nov 09 '20 at 20:51
  • @cls Try it with the script tags below the body – Uuuuuumm Nov 09 '20 at 20:54
  • @Uuuuuumm thanks, that helped. I'm not sure how to mark you as the answer though... – clonts Nov 09 '20 at 21:02
  • 1
    Don't put your script outside of the body... – Dominik Nov 09 '20 at 21:02
  • 1
    Thx @Dominik. I retract my advice to put the script outside the body, unless you are going to put it in the head and use `defer` https://stackoverflow.com/questions/3037725/is-it-wrong-to-place-the-script-tag-after-the-body-tag – Uuuuuumm Nov 09 '20 at 21:09