JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<label for="Male">
<input type="radio" class="button" id="Male" name="gender" >Male</input>
</label>
<label for="Female">
<input type="radio" class="button" id="Female" name="gender">Female</input>
</label>
</form>
CSS
/*----------------------------------
SIDEBAR
----------------------------------*/
input[type=radio], input[type=checkbox] {
display: none;
}
label {
display: block;
appearance: button;
-webkit-appearance: button;
-moz-appearance: button;
-ms-appearance: button;
font-family:'Roboto', sans-serif;
font-weight: 400;
background: #DDDDDD;
font-size: 1.6rem;
color: #111111;
border: 2px solid #AAAAAA;
padding: 8px;
width: 40%;
margin: 0 auto;
text-align: center;
transition: all 0.7s ease-in-out;
}
.yellowBackground {
background-color:yellow;
}
JavaScript
$(document).ready(function() {
$('label').click(function() {
$('label').removeClass('yellowBackground');
$(this).addClass('yellowBackground');
});
});