JSFiddle - React, Tailwind, and code Playground
by DannyEnglander
HTML
<div class="form-type-checkbox">
<input type="checkbox" id="edit-gift" name="gift" value="1" class="form-checkbox">
<label class="option" for="edit-gift">Make this a gift</label>
</div>
JavaScript
$('input[type=checkbox]').click(function () {
if ($(this).is(':checked')) {
$(this).next('label').toggleClass('checked', this.checked).removeClass('not-checked');
}
else {
$(this).next('label').addClass('not-checked').removeClass('checked');
}
});