-
-
Save JamesMaroney/b7f26cfc4536504790f0 to your computer and use it in GitHub Desktop.
Using script text for configuration of externally referenced script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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