CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: JavaScript

Code Snippet to Dynamically Load jQuery into a browser

285 Views
Copy Code Show/Hide Line Numbers
/* Script to add jQuery into current page via Firebug/Console */
(function() {
  var b = "jQuery script is now available.";
  try {
    var a = document.createElement("script");
    a.setAttribute("type", "text/javascript");
    a.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
    document.getElementsByTagName("head")[0].appendChild(a);
    window['$j']=jQuery;
    setTimeout(function(){
      if(window['jQuery']){window['jQuery'].noConflict(); alert('jQuery added.');}
    }, 100);
  }catch(c) {
    b = "jQuery script is NOT available yet."
  }return b
})();
by Nordin
  April 14, 2010 @ 3:16am
Tags:
Description:
This code snippet will help to load jQuery onto current page.

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate