JSFiddle - React, Tailwind, and code Playground
by Ilia Lesnykh
HTML
<div>
<input type="checkbox">
<input type="text">
</div>
<div>
<input type="checkbox" checked>
<input type="text">
</div>
<div>
<input type="checkbox">
<input type="text">
</div>
JavaScript
function checkState() {
var $checkbox = $(this);
var $input = $checkbox.next('input');
$input.prop("disabled", !!$checkbox.prop("checked"));
}
$(function(){
$(":checkbox").each(function(){
checkState.apply(this);
$(this).on('click', checkState);
});
});