I'm having some checkboxes and text inputs. The Text inputs are disabled when the pages loads. If a checkbox is checked, the corresponding input should be fillable. Here's my current code
For some reason I can't seem to get it right, I'm pretty new to JS and Jquery. When I click the checkboxes, nothing happens, and when I load the page I get 6 times the text "false"
    var c1 = $('#check1');
    var c2 = $('#check2');
    var c3 = $('#check3');
    var f1 = $('#field1');
    var f2 = $('#field2');
    var f3 = $('#field3');
    $(function() {
        enable_cb(c1, f1);
        enable_cb(c2, f2);
        enable_cb(c3, f3);
        c1.click(enable_cb(c1, f1));
        c2.click(enable_cb(c2, f2));
        c3.click(enable_cb(c3, f3));
    });
    function enable_cb(checkbox, field) {
        if (checkbox.checked) {
            console.log('if');
            field.removeAttr("disabled");
        } else {
            console.log('else');
            field.attr("disabled", true);
        }
    }
Here's a piece of html, the other parts look the same as this one:
<div class="form-group" >
    <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect customcheckbox" for="check1">
        {{ Form::checkbox('check', 1, null, ['class' => 'mdl-checkbox__input', 'id' => 'check1']) }}
        <span class="mdl-checkbox__label">test</span>
    </label>
</div>
<div class="form-group" >
    <label for="field1">test<br></label>
    <select id="field1" name="field1" disabled class="searchselect searchselectstyle">
    </select>
    @if ($errors->has('field1'))
        <span class="help-block">
            <strong>{{ $errors->first('field1') }}</strong>
        </span>
    @endif
</div>
 
     
    