JSFiddle - React, Tailwind, and code Playground

by CrossEye

HTML

<div class="optionBox" id="fruit">
    <h2>Fruit</h2>
    <label><input type="checkbox" id="apple"/> Apple</label>
    <label><input type="checkbox" id="banana"/> Banana</label>
    <label><input type="checkbox" id="kiwi"/> Kiwi</label>
    <label><input type="checkbox" id="orange"/> Orange</label>
</div>
<div class="optionBox" id="veggie">
    <h2>Vegetable</h2>
    <label><input type="checkbox" id="broccoli"/> Broccoli</label> 
    <label><input type="checkbox" id="corn"/> Corn</label>
    <label><input type="checkbox" id="kale"/> Kale</label>
    <label><input type="checkbox" id="potato"/> Potato</label>
</div>

CSS

div {margin-bottom: 2em; padding: .5em;}
h2 {border-bottom: 1px solid #ccc; margin: 0 0 1em; font-size: 125%;}
label {display: block;}

JavaScript

$('.optionBox :checkbox').click(function() {
   var $checkbox = $(this), checked = $checkbox.is(':checked');
   $checkbox.closest('.optionBox').find(':checkbox').prop('disabled', checked);
   $checkbox.prop('disabled', false);
});