Tap for Menu

Basic Tags

There are several ways to add JS to your HTML document. The first method involves embedding JS write into the document.

Embedding

All of your JS script should go inside a {script} tag.

You can have multiple script tags in one document. This is not usually recommend, because you'll have to copy it into each HTML document. You will also have to change the code in each individual location which could be a headache.

Linking

It is generally recommended and much easier to have all of your scripts in a separate .js file. As you can see below it is much easier to reference also.

This way if you change the code in the one .js file, it will be updated across all of your HTML files.

From the example above in my "scripname.js" file I would contain all of my JS content. Make sure you save it with a .js extension.