Created
May 7, 2014 12:57
-
-
Save patcullen/82cb113a2fbdb9996aca to your computer and use it in GitHub Desktop.
Inject CSS with Javascript
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
<!DOCTYPE html> | |
<head> | |
<script src="injectCSS.js"></script> | |
</head> | |
<body> | |
<div class="test case1">test case 1</div> | |
<div class="test case2">test case 2</div> | |
<script> | |
(function(){ | |
injectCSS(function(){/* | |
.case1 { | |
border: 3px solid #0f0; | |
} | |
*/}); | |
injectCSS('.case2 { border: 3px solid #00f; } '); | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment