JSFiddle - React, Tailwind, and code Playground

by Siddharth Motwani

HTML

<input type="text" id="txt1"/>
<input type="checkbox" id="chk1" />

JavaScript

$('#chk1').change(function() {
        if($(this).is(":checked")) {
            $("#txt1").attr("disabled", "disabled"); 
        }
        else
        {
            $("#txt1").removeAttr("disabled"); 
        }
    });