Hello,
I just got into javascript and need a bit of help dealing with a script im working on. The script relies on two javascript libraries to be loaded prior to me loading my own script. I’ve done some testing and for some reason it still shows in this order.
1 – My Script loaded
2 – jQuery UI loaded
3 – jQuery loaded
Yet I want it in this order so that jQuery & jQuery UI would offer their functionality to my script. The script should load in this order.
1 – jQuery
2 – jQuery UI
3 – My Script
This order is exactly the reverse of what i need. Any help would be greatly appreciated. Here is my code below.
[CODE]
loadjQuery();
function loadjQuery(){
head=document.getElementsByTagName(‘head’)[0];
var jqs=document.createElement(‘script’);
jqs.setAttribute(‘type’,’text/javascript’);
jqs.setAttribute(‘src’,’jquery-1.3.2.min.js’);
head.appendChild(jqs);
jqs.onload = loadjQueryUI();
jqs.onload = console.log(‘jQuery Loaded’);
}
function loadjQueryUI(){
head=document.getElementsByTagName(‘head’)[0];
var jus=document.createElement(‘script’);
jus.setAttribute(‘type’,’text/javascript’);
jus.setAttribute(‘src’,’jquery-ui-1.7.1.custom.min.js’);
head.appendChild(jus);
jus.onload = loadms();
jus.onload = console.log(‘jQuery UI Loaded’);
}
function loadms(){
head=document.getElementsByTagName(‘head’)[0];
var ms=document.createElement(‘script’);
ms.setAttribute(‘type’,’text/javascript’);
ms.setAttribute(‘src’,’My Script’);
head.appendChild(ms);
ms.onload = console.log(‘My Script Loaded’);
}