console.log("Testing");
const p = document.createElement("p")
p.innerHTML = "This is to test the javascript extension";
const body = document.querySelector("body");
body.appendChild(p);
<!DOCTYPE html>
<html>
<head>
<title>Testing vs code</title>
<link rel="stylesheet" type="text/css" href="styles.css"/>
</head>
<body>
<h1>Testing the vscode html preview package</h1>
<h2>Hello</h2>
<script type="module" src="js-prac.js"></script>
</body>
</html>
I need help, please. I posted a question earlier about this but I think I made some mistakes and made it confusing. I keep getting a "document is not defined" error every time.
is there a way I can resolve this please?
console.log("Testing");
const p = document.createElement("p")
p.innerHTML = "This is to test the javascript extension";
const body = document.querySelector("body");
body.insertBefore(p,body.childNode[-1]);
<!DOCTYPE html>
<html>
<head>
<title>Testing vs code</title>
<link rel="stylesheet" type="text/css" href="styles.css"/>
</head>
<body>
<h1>Testing the vscode html preview package</h1>
<h2>Hello</h2>
<script type="module" src="js-prac.js"></script>
</body>