JSFiddle - React, Tailwind, and code Playground
by bgmort
HTML
If the background is green, the stylesheet worked.
JavaScript
function getDynamicStylesheet(){
var ds = $('#dynamic-stylesheet');
if (!ds.length) {
ds = $('<style id="dynamic-stylesheet"> </style>').appendTo('head');
}
ds = ds[0];
var sheet = ds.sheet || ds.styleSheet;
if (!sheet.addRule) sheet.addRule = function(selector, rule){
this.insertRule(selector + ' { ' + rule + ' }', 0);
}
return sheet
}
getDynamicStylesheet().addRule('body,html', 'background: green');