JSFiddle - React, Tailwind, and code Playground

by Megi93

HTML

<input type="checkbox" id="yourBox">
<input type="text" id="yourText">

JavaScript

var checkbox = document.querySelector("#yourBox");
var input = document.querySelector("#yourText");

var toogleInput = function(e){
  input.disabled = !e.target.checked;
};

toogleInput({target: checkbox});
checkbox.addEventListener("change", toogleInput);