JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" id="cb" />
<label for="cb">label for checkbox</label>
<input type="text" id="txt" style="display: none;" />
JavaScript
var checkbox = $('#cb');
var textfield = $('#txt');
checkbox.click(function() {
if (checkbox.is(':checked')) {
textfield.show();
}
else
{
textfield.hide();
}
});