/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(function(){ var myBkl = { jq: null, loadScript: function(src) { if(window.jQuery && window.jQuery.fn.jquery == '1.3.2'){ return; } var s = document.createElement('script'); s.setAttribute('src', src); s.setAttribute('type', 'text/javascript'); document.getElementsByTagName('head')[0].appendChild(s); }, whenLoaded: function(callback){ if (typeof(window.jQuery) !== 'undefined' && window.jQuery.fn.jquery == '1.3.2') { myBkl.jq = window.jQuery.noConflict(true); callback(myBkl.jq); } else { setTimeout((function() {myBkl.whenLoaded(callback); }), 100); } }, init: function($){ console.log($.fn.jquery); console.log(window.jQuery.fn.jquery); } }; myBkl.loadScript('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js'); myBkl.whenLoaded(myBkl.init); })();