JSFiddle - React, Tailwind, and code Playground

by ysis81

HTML

<div id="PlayerVsComputer" class="checkbox">                                        
  <label><input type="checkbox" class="game">                                        
   <div class="btn-group" role="group"> 
    <button type="button" class="btn btn-inverse btn-xs">Player</button>             
    <button type="button" class="btn btn-clssic btn-xs">Computer</button>            
   </div>
  </label>
 </div>

CSS

.btn-classic {
  color: black;
  background-color: white;                                                               
  }
   
   
.btn-inverse {
  color: white;                                                                          
  background-color: black;                                                               
  }

JavaScript

// Flip buttons color when mouse is over buttons
var buttons = $('#PlayerVsComputer .btn').mouseenter(toggle).mouseleave(restore);

function toggle() {
  buttons.each(function(index, value) {
    $(value).toggleClass('btn-inverse btn-clssic');
  });
}

function restore() {
  buttons.eq(0).removeClass('btn-clssic').addClass('btn-inverse');
  buttons.eq(1).removeClass('btn-inverse').addClass('btn-clssic');
}