Skip to content

Instantly share code, notes, and snippets.

@knorthfield
Created June 14, 2013 16:18
Show Gist options
  • Save knorthfield/5783229 to your computer and use it in GitHub Desktop.
Save knorthfield/5783229 to your computer and use it in GitHub Desktop.
Access script tag attributes in script.
<script type="text/javascript" data-message="hello">
var scripts = document.getElementsByTagName( 'script' );
console.log(scripts[ scripts.length - 1 ].getAttribute('data-message'));
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment