JSFiddle - React, Tailwind, and code Playground

by ohcibi

HTML

<input type="checkbox" id="test" name="test"><label for="test">Test</label>

CSS

input {
  display: none;
}

input:checked + label {
  background: black;
  color: white;
}

JavaScript

$(function() {
  $('#test').change(function() { console.log($(this).attr('checked')); });
});