Created
November 25, 2013 16:59
-
-
Save Geruhn/7644599 to your computer and use it in GitHub Desktop.
JavaScript: addGlobalStyle(css)
This file contains hidden or 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
function addGlobalStyle(css) { | |
var head, style; | |
head = document.getElementsByTagName('head')[0]; | |
if (!head) { return; } | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = css; | |
head.appendChild(style); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works perfectly, Thank you. I used it in one of my scripts here. I commented your snippet. I hope this is ok for you?