0
why wont my js code work? it works on solelearn but not on vs code or notepad
. I am using a code I got from someone and decided to tweak it a bit and then I went to link the files together on VS code/notepad but it's not working, I replaced all the comment symbols as they didn't seem to comment properly, but still not working. if possible can someone please fix it for me or tell me what to do, also how I would link these files. ps, I don't know javascript very well just started to learn it so it may be obvious things. And I included the links to each file aswell https://code.sololearn.com/WehCc307rV6C/?ref=app
9 odpowiedzi
+ 2
It is working on code playground
+ 1
make sure the script file is linked. Are you using an external file? if so, add <script src="name.js"></script>
0
but not in an external file
0
i dont think the js is working though
0
I know, you have said it already.
What did you do when you tried running the code on vs code?
Make sure you do the following:
Make a file called index.html, that is how you will open your website.
Then, copy all the html code to this file.
Then, in the <head> tag in the html create a tag called <style></style> and in it paste all of the css code.
Then, in your <body> tag, make a tag called <script></script> and in it paste all of your javascript code.
That should work.
0
i have done that but except just linked the files instead of adding all the code to one file.
(ps the css works)
this is what is in vs code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Hacker Terminal</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="cmd">enter
<e></e>commands...<br><br>This hacking terminal is fully functional and also works for some commands<br><br></div>
<div id="cmdbar"><input type="text" id="command" placeholder="enter command here..."></div>
<script src="script.js"></script>
</body>
</html>
0
coder crux could you try run it in your computer, if you have What happened
0
If you still have this error, then yes, it is working perfectly fine.
I took the liberty of making the file for you.
https://pastebin.com/hruMWxzH
- 1
i have linked the script