JSFiddle - React, Tailwind, and code Playground

by misbehavens

HTML

<div class="checkbox-wrapper">
    <input type="checkbox"> Click anywhere in this container<br> to toggle the checkbox.
</div>

CSS

.checkbox-wrapper {
    float: left;
    padding: 10px;
    background-color: #090;
    color: #fff;
    cursor: pointer;
}

JavaScript

$('.checkbox-wrapper').click(function(){
    var $checkbox = $(this).find('input[type="checkbox"]');
    if ($checkbox.is(':checked')) {
        $checkbox.attr('checked', false);
    } else {
        $checkbox.attr('checked', true);
    }
});