Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // My Solution To Load jQuery From Your Script File If It Isn't Already Loaded!!!!!
- window.$ && main() || (function() {
- var jquery = document.createElement("script");
- jquery.setAttribute("type","text/javascript");
- jquery.setAttribute("src","jquery.js");
- jquery.onload = main;
- jquery.onreadystatechange = function() {
- if (this.readyState == "complete" || this.readyState == "loaded") main();
- };
- (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(jquery);
- })();
- function main() {
- // run your website's script
- }
- // jQuery's Implementation Of This On Wikipedia [ Just Noticed This :( ]
- // Just to make things clear this does not serve the same purpose as my solution and wouldn't work without some modification.
- http://en.wikipedia.org/wiki/JQuery
- if(!(window.jQuery && window.jQuery.fn.jquery == '1.6.2')) {
- var s = document.createElement('script');
- s.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');
- s.setAttribute('type', 'text/javascript');
- document.getElementsByTagName('head')[0].appendChild(s);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement