Posted By

brandonjp on 07/28/10


Tagged

javascript js textmate script auto jquery dynamic load loader jQ


Versions (?)

jQuery dynamic loader - load jquery using pure js javascript if jQ is undefined or does not exist


 / Published in: jQuery
 

  1. // jQuery dynamic loader - load jQuery using pure javascript js
  2. // if jQuery is undefined or does not exist, then load it
  3.  
  4. if ( !window.jQuery ) {
  5. var jqscript = document.createElement('script');
  6. jqscript.setAttribute("type", "text/javascript");
  7. jqscript.setAttribute("src", "http://code.jquery.com/jquery.min.js");
  8. document.getElementsByTagName("head")[0].appendChild(jqscript);
  9. };

Report this snippet  

You need to login to post a comment.