Reputation: 281
I have a Js function that I would like to:
I would like to do this JS side and not reference on the actual page as I need this process to happen dynamically.
Upvotes: 1
Views: 958
Reputation: 47776
If you're working with the browser, jQuery has an helper function for it, $.getScript.
Upvotes: 1
Reputation: 1413
var h = document.getElementsByTagName('head')[0],
s = document.createElement('script');
s.type = 'text/javascript';
s.onload = function () { document.getElementById('hello').innerText = h.innerText; };
s.src = 'http://html5shiv.googlecode.com/svn/trunk/html5.js';
h.appendChild(s);
Upvotes: 2
Reputation: 41246
The only option I can think of is to dynamically insert a new script tag into the page targeting your desired script from your initial javascript. Just have your initial script insert the new <script>
tag on load, or upon request and then test for availability.
Upvotes: 0