JSFiddle - React, Tailwind, and code Playground

HTML

<input id="check" type="checkbox" />
<input id="txt" type="text" value="aaaa" />

JavaScript

$(document).ready(function () {

    $('input[type=checkbox]').click(function(){
       if ($('input[type=checkbox]').is(':checked')) {
        $('#txt').val('checked');
    }
    else{
        $('#txt').val('unchecked');
    }
    });
   
});