Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andreibabor/be4b53d8bec532fb8485f1cebd7b6997 to your computer and use it in GitHub Desktop.
Save andreibabor/be4b53d8bec532fb8485f1cebd7b6997 to your computer and use it in GitHub Desktop.
Javascript create text/javascript using var
<script>
$( document ).ready(function() {
//create a script element and set it's type and async attributes
var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
//set the source of the script element
script.src = 'https://widgets.quadpay.com/stfrank/quadpay-widget-0.2.0.js?type=calculator&min=1&max=2500';
//add the script element to the DOM
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
//~initialise what you want~
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment