JSFiddle - React, Tailwind, and code Playground
by bmarsh123
HTML
<div><input disabled="disabled" type="text" id="input1" /></div>
<div><input checked="checked" id="rb1" type="radio" value="0" name="rb1" class="rb" /><label for="rb1">Disable</label></div>
<div><input id="rb2" type="radio" value="1" name="rb1" class="rb" /><label for="rb2">Enable</label></div>
JavaScript
$('.rb').change(function() {
if ($(this).val() == '0') {
$('#input1').attr('disabled', 'disabled');
} else if ($(this).val() == '1') {
$('#input1').removeAttr('disabled');
}
});