How to link my JavaScript file to HTML

Am new here. Please, am having problem with JavaScript. My code works internally on html but external, it doesn’t work. What do I do?

What do you mean by external? Can you provide us with some of your code?

This is where I placed the source code for the external code for JavaScript

Try putting the dot before your location : "./js/myscript.js".

The above image is the code for JavaScript .

I have done but it’s not showing.

I have done that but it’s not showing. Please, do you have any idea on what I should do?

Can you show me how does the folder that contains your files look like?

Your file is called myscript.js but you’re linking to "myscripts.js".

1 Like

This is folder that contains all the files. Is is the folder that houses my script file

I mean JS houses my script file

Hi @Ladyphil
Welcome to FCC.

Instead of posting images of your source code, you can copy and paste snippets of your source code. When you enter a code block, precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Ok. But making post with phone and with desktop.

I mean I discuss here using my phone, and I don’t know how to code using my phone.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.