Home  >  Article  >  Web Front-end  >  Method of dynamically loading jQuery_jquery

Method of dynamically loading jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 15:54:331287browse

The example in this article describes the method of dynamically loading jQuery. Share it with everyone for your reference. The details are as follows:

function checkJquery() {
 if(!(window.jQuery)) {
  var s = document.createElement('script');
  s.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
  s.setAttribute('type', 'text/javascript');
  document.getElementsByTagName('head')[0].appendChild(s);
 }
}

I hope this article will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn