JSFiddle - React, Tailwind, and code Playground

by Yurii Shpylovyi

HTML

<input class="form-control" type="checkbox" id="general" name="general" value="0">
<input class="form-control" type="checkbox" id="luxury" name="luxury" value="0">
<input class="form-control" type="checkbox" id="mice" name="mice" value="0">

JavaScript

$("#general, #luxury, #mice").on('click', function(){
        console.log('click');
        if ($(this).is(':checked')) {
            //console.log('1');
            $(this).val('1');
            console.log( $(this).attr('id')+' '+ $(this).val());
        } else {
            //console.log('0');
            $(this).val('0');
            console.log( $(this).attr('id')+' '+ $(this).val());
        }
    });