Skip to content

Instantly share code, notes, and snippets.

@NigelThorne
Created May 8, 2012 22:51
Show Gist options
  • Save NigelThorne/2640138 to your computer and use it in GitHub Desktop.
Save NigelThorne/2640138 to your computer and use it in GitHub Desktop.
Load JQuery & JQueryUI programatically
//Taken from http://www.jquery4u.com/javascript/dynamically-load-jquery-library-javascript/
//Load jQuery library using plain JavaScript
(function(){
var newscript = document.createElement('script');
newscript.type = 'text/javascript';
newscript.async = true;
newscript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);
})();
//Load jQuery library using plain JavaScript
(function(){
var newscript = document.createElement('script');
newscript.type = 'text/javascript';
newscript.async = true;
newscript.src = 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment