Im working on a website where i have the following code:
index.html
<!DOCTYPE html>
<html lang="nl">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="module" src="../javascript/info.js"></script>
</head>
<body onload="test()">
<header>
</header>
<nav>
</nav>
<section>
</section>
<footer>
</footer>
</body>
</html>
and info.js:
import { Movie } from "./classes.js";
function test(){
document.querySelector('section').innerHTML = "hello test";
}
When loading the page, i get the error:
Uncaught ReferenceError: test is not defined at onload (info.html:15:25)
but I do have test()
defined, so why the error??