I'm a beginner in javascript, just learning. I had an issue with the tag and the "src" command. When I run my html file from the root directory it works, but it doesn't work when I'm using another folder, for example a folder in the desktop... I tried and searched all that came to my mind, but no clue.
I'm using Sublime Text in UbuntuMate with Firefox browser.
This is the HTML file.`
<!doctype html>
<html>
<body>
<script scr="myscript.js"></script>
</body>
</html>
And this is the "myscript.js" file (it's in the same folder)
alert('hello hello pls work');
know this is a silly question but I just wanna know if is a code issue or a some kind of permission/system issue. Thanks a lot.
I tried to use the full path, the "./" and another locations inside the root directory, and searched in the internet.
The only mistake I see is that you put scr
instead of src
in your <script>
tag. I've tested it, making no changes other than that, and it works; it's just a little easy slip-up. 😉
This is the line corrected:
<script src="myscript.js"></script>