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?
Asked
Active
Viewed 138 times
0

System32
- 1
-
I want the same code (relation) in a javascript code – System32 Oct 18 '13 at 23:24
-
so I want a javascript code that call the source "http://code.jquery.com/jquery-latest.min.js" – System32 Oct 18 '13 at 23:25
-
Sorry, but you are not very clear. Is what you want to load files via javascript as opposed to loading files with html-tags? – m3o Oct 18 '13 at 23:26
-
something like that but not exactly the same thing – System32 Oct 18 '13 at 23:27
1 Answers
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