i wrote this html document and the script isn’t running
alert("my name")
<html>
<body>
fvbnhjm
<script type="textjavascript" src="JavaScript.js">
</script>
</body>
</html>
i installed code runner in vs code and the only thing that i added to settings.json is this
"code-runner.saveAllFilesBeforeRun": true,
"code-runner.saveFileBeforeRun": true,
"code-runner.executorMapByFileExtension": {
".js": "cd $dir $$ start $fileName",
".html": "cd $dir && start $fileName"
},
javascript isn’t disabled in my browser, i don’t need node.js here but i installed it
2
Answers
textjavascript
isn’t the correct type for javascript.You can omit the type attribute, but if you’re going to include it you need a
/
instead of.
Let’s see your folder structure, make sure you have type a valid path to your js file.
Looking for simple way to type the path? Just right click on your js file and click copy path. Then, paste it in src="file.js".
You can read more about it in this thread.
Thank you