0
点赞
收藏
分享

微信扫一扫

动态加载jquery


  如果要在js中动态加载jquery的话,可以这样:

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);}
}

举报

相关推荐

0 条评论