JSFiddle - React, Tailwind, and code Playground

by Luis Martin

HTML

<input type="text" id="textbox1" disabled="disabled">
<input type="text" id="textbox2">

CSS

input {
  background: red;
}

input:disabled {
  
  background: blue;
}

JavaScript

var css = 'input:disabled { background: yellow; }',
    head = document.head || document.getElementsByTagName('head')[0],
    style = document.createElement('style');

head.appendChild(style);

style.type = 'text/css';
if (style.styleSheet){
  // This is required for IE8 and below.
  style.styleSheet.cssText = css;
} else {
  style.appendChild(document.createTextNode(css));
}