JSFiddle - React, Tailwind, and code Playground

by KelseyW

HTML

<body>
  <div id="content">
    <input tabIndex="1">
    <input tabIndex="2">
    <select tabIndex="3">
      <option>select menu</option>
    </select>
    <div tabIndex="4">
      a div
    </div>
  </div>
</body>

CSS

.focused {
    background: #abcdef;
  }

JavaScript

< script >
   $("#content").delegate("*", "focus blur", function() {
     var elem = $(this);
     setTimeout(function() {
       elem.toggleClass("focused", elem.is(":focus"));
     }, 0);
   });