Page 1 of 1

including js file inside a js file (jQuery specific)

Posted: Mon Oct 29, 2007 10:30 am
by GeXus
I'm trying to include jQuery from within another js file... here is how I'm doing it..

Code: Select all

function include_js(name) {

var th = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.setAttribute('type','text/javascript');
s.setAttribute('src',name);
th.appendChild(s);

}


include_js('jquery.js');
I've tested this with including just a simple file that has an alert in it.. and the alert works... however, when trying to include jQuery, none of jQuery's functions are recognized...

any ideas?