expected outcome: div "test" should be shown,
but error in console: "Uncaught TypeError: Cannot read properties of null (reading 'style')"
It already worked in the past but somehow it stopped working (I guess it stopped when splitting html, css and js in different files but im not sure)
My simplified source code:
index.html
<link rel="stylesheet" type="text/css" href="./main.css">
<script src="./main.js"></script>
<div id="test"> test </div>
main.css
#test{display: none}
main.js
//(agree not defined so typeof(agree) == undefined)
if (agree == undefined) { document.getElementById("test").style.display = "block"; }
what did I do wrong? or is it actualy the splitted file / external js/css