JSFiddle - React, Tailwind, and code Playground

HTML

<form>
<input type="text" id="txt1"/>
<input type="checkbox" id="chk">
</form>
<form>

<input type="text" id="txt2"/>
<input type="checkbox" id="chk">
</form>

JavaScript

$(document).ready(function(){
    $('#chk').live('change',function(){
    if(!$(this).is(':checked'))
     $('#txt1').val('');              
    });
        
});