Only logged in members can reply and interact with the post.
Join SimilarWorlds for FREE »

Anyone good with HTML and Javascript?

I need to include multiple Javascript files into a HTML without using jQuery if anyone knows how to do that.. that'd be awesome.
This page is a permanent link to the reply below and its nested replies. See all post replies »
Could you please specify what you mean by include JS files?

The way I know it, you can include JS files by simply writing <script src="myscript.js"></script> for each script in hierarchical order.
If you don't want an ugly HTML page full of these <script> tags, you could use a tool like webpack.
@Existentior:

I've included two external JS files just like that:

<script src="script1.js"></script>
<script src="script2.js"></script>

Although with that method I think there's an issue with priority? Because only script1 runs.
@Samael: Yes, JS scripts run in order of dependence, so if script2 depends on script1, then script1 needs to be written first. If however script2 fails to parse correctly, then there must be something wrong with it.

You should find out why by inspecting the Javascript console's messages:
In Chrome/Firefox: Ctrl+Shift+J or F12

Alternatively as a small debug test, you could write alert('script2 testing'); in your second script to see if your HTML page loads that correctly.

There's also a tool to tell you if your JS script conforms to the rules and tell you what's right or wrong with it:
http://www.jslint.com/
This one is better: http://jshint.com/
Thanks a lot! I really appreciate you taking the time to help me out! I'll give those things a try.
@Samael: I'll be back later. I hope it works out for you. I'll read the replies later.