JSFiddle - React, Tailwind, and code Playground
HTML
<input type='button' class='btn ' />
<input type='button' class='btn' />
<input type='button' class='btn' />
CSS
.active {
background-color: red
}
.inactive{
background-color:green;
}
JavaScript
$('.btn').click(function() {
$(this).addClass('inactive');
$('.btn').not(this).removeClass('active');
});