How to include jquery.js in another js file?

后端 未结 4 748
时光说笑
时光说笑 2020-12-03 14:48

I want to include jquery.js in myjs.js file. I wrote the code below for this.

  var theNewScript=document.createElement(\"script\");
  theNewScript.type=\"te         


        
4条回答
  •  無奈伤痛
    2020-12-03 15:33

    I used this code before, and it worked:

    var t=document;
    var o=t.createElement('script');
    o=t.standardCreateElement('script');
    o.setAttribute('type','text/javascript');
    o.setAttribute('src','http://www.example.com/js/jquery-1.3.2.js');
    t.lastChild.firstChild.appendChild(o);
    

提交回复
热议问题