0

I am trying to implement something like this:

function ()
{
     <script src="js/jquery.min.js"></script>
}

Basically I want to load a .js file from a function. Any advice would be very helpful.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • check the link http://www.sitepoint.com/dynamically-load-jquery-library-javascript/ – singhakash Jan 31 '15 at 06:55
  • In addition to the question this is marked a duplicate of, here's a very capable function for loading scripts: http://stackoverflow.com/questions/6989020/javascript-multiple-dynamic-insertion/6989187#6989187 – jfriend00 Jan 31 '15 at 07:24

1 Answers1

0
function loadjs(src){
  var js=document.createElement('script')
  js.setAttribute("type","text/javascript")
  js.setAttribute("src", src)
}



//loadjscssfile("https://code.jquery.com/jquery-2.1.3.min.js")
taesu
  • 4,482
  • 4
  • 23
  • 41