I have a Js function that I would like to:
- Reference another js file
- Pull a function out.
I would like to do this JS side and not reference on the actual page as I need this process to happen dynamically.
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.
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);
If you're working with the browser, jQuery has an helper function for it, $.getScript.