I've looked at a few posts on stack overflow saying that this should work.
<script type="text/javascript" src="fcn1.js"></script>
<script type="text/javascript" src="fcn2.js"></script>
The scripts have for example
fcn1.js:
function myFunc() {
alert('This script accessed by other script');
}
fcn2.js:
myFunc();
When I try to do this I get a referenceError, saying MyFunc() is not defined.
The scripts are loaded in order like that, is there an equivalent for $("#something").on("load", function() { });
that I could use to wait for the first script to load?
In my case, script 1 has 702 lines so it could be possible that it's not loading fast enough? I wouldn't think so because those functions that I'm trying to access by an external file are triggered almost immediately upon first load of the page. (not triggered by the second script, but they are triggered within the first script).