Last active
December 24, 2015 11:09
-
-
Save pbojinov/6788608 to your computer and use it in GitHub Desktop.
style.innerHTML fix for IE
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
| var style = document.createElement('style'), | |
| styleContent = 'body{background-color: red;}'; | |
| //IE 8 and below | |
| if (style.styleSheet) { | |
| style.styleSheet.cssText = styleContent; | |
| } | |
| else { | |
| style.innerHTML = styleContent; | |
| } | |
| document.getElementsByTagName('head')[0].appendChild(style); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment