JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" class="checkbox1" />
<div class="text">text</div>
CSS
.text
{
width: 50px;
}
JavaScript
$(document).ready(function() {
$('.checkbox1').change(function(){
if (this.checked) {
$('.text').css('background-color', 'red')
}
else {
$('.text').css('background-color', 'white')
}
});
});