JSFiddle - React, Tailwind, and code Playground

by Ashish

HTML

<input type="checkbox" value="Enabled" id="checkbox" />
<input type="text" value="" id="textbox" readonly="readonly" />

JavaScript

$("#checkbox").click(function (){
      if($(this).attr("checked") == "checked"){
         $("#textbox").removeAttr("readonly", false);            
          $("#textbox").focus()
      }
       else{
         $("#textbox").attr("readonly", "readonly");
       }                   
       
   });