function addScript( url ) {
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.charset = 'utf-8';
script.src = url;
document.getElementsByTagName('head')[0].appendChild( script );
};
You would use it by doing something like:
addScript('jquery.js');
I would recommend doing a search on the Nabble mailing list page for this,
as it has been covered many times before.
Cheers,
Dan Atkinson
bohumil wrote:
>
> Hello.
>
> I want to load file jquery.js into my web page dynamically. I tried this
> code:
>
> script = document.createElement('script');
> script.src = 'jquery.js';
> x = document.getElementsByTagName('head')[0];
> x.appendChild(script);
>
> this code works with my other javascript file, but it doesn't work
> jquery.js. Could you help me please?
>
>
--
View this message in context:
http://www.nabble.com/dynamic-loading-of-jquery.js-into-my-web-page-tf2905089.html#a8122926
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/