This is my index.html
:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<script src="app.js"></script>
<h1>The fantastic website</h1>
<h2>A humble experience</h2>
<div id="hold">
<p>Test! And test again!</p>
</div>
</body>
</html>
This is my app.js
:
const thediv = document.getElementById('hold');
console.log(thediv);
When I access the page and look to the console, I see this: Console showing "null"
When I repeat this same app.js
code in the console, I can select the element. But using this code, I just get "null". What am I missing here?