JSFiddle - React, Tailwind, and code Playground

by kazu69

HTML

<input type="checkbox" id="checkbox1" /> <br />
<input type="text" id="textbox1" />

JavaScript

$(document).ready(function() {
    //set initial state.
    $('#textbox1').val($(this).is(':checked'));
    
    $('#checkbox1').change(function(event) {
        event.preventDefault();
        if($(this).is(":checked")) {
            $(this).attr("checked", true);
        }
        $('#textbox1').val($(this).is(':checked'));        
    });
});