0

I have this pretty simple script relationship:
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
I'm wondering how could I do the same function that this code does using javascript?

1 Answers1

2

Create a script tag and append it to the head of your html document.

var s = document.createElement('script');
s.setAttribute('type', 'text/javascript');
s.src = "http://code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(s);
Benjamin Toueg
  • 10,511
  • 7
  • 48
  • 79