Skip to content

Instantly share code, notes, and snippets.

@JamesMaroney
Created May 8, 2013 17:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamesMaroney/b7f26cfc4536504790f0 to your computer and use it in GitHub Desktop.
Save JamesMaroney/b7f26cfc4536504790f0 to your computer and use it in GitHub Desktop.
Using script text for configuration of externally referenced script
In the markup:
```
<script>
// configuration goes here
</script>
```
In the script.js
```
var script = document.getElementsByTagName(“script”);
script = script[script.length - 1];
configure(script.text); // script.text is the text inside the script tag in the DOM
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment