including js file inside a js file (jQuery specific)

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

including js file inside a js file (jQuery specific)

Post 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?
Post Reply