index.html
<!DOCTYPE html>
<html>
<head>
<title>JavaScript </title>
<meta charset="UTF-8" />
</head>
<body>
<div class="App"></div>
<script src="./index.mjs" type="module"></script>
</body>
</html>
index.mjs
console.log("Script loaded"); this is priting only
document.addEventListener("DOMContentLoaded", () => {
console.log("DOM fully loaded and parsed"); //nothig prints inside this event
});
I want code inside DOMContentLoaded to work but its not working at all in simple code. Can someone tell me what I am doing wrong here.