JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<fieldset id="radiobuttons">
<legend>pick</legend>
<input type="radio" name="radiobutton" value="Yes" />
<input type="radio" name="radiobutton" value="No" />
</fieldset>
<fieldset id="field1" style="display:none;">
<legend>field1</legend>
<input type="text" name="fdsa" value="dsfa" /><br />
<input type="text" name="fdsa" value="fds" /><br />
</fieldset>
<fieldset id="field2" style="display:none;">
<legend>field2</legend>
<input type="text" name="asdf" value="asdf" /><br />
<input type="text" name="asdf" value="fdas" /><br />
</fieldset>
</form>
JavaScript
jQuery("input[name=radiobutton]").change(function() {
if (jQuery(this).val() == "Yes") {
jQuery("#field1").fadeIn('slow');
}
else {
jQuery("#field1").hide();
}
if (jQuery(this).val() == "No") {
jQuery("#field2").fadeIn('slow');
}
else {
jQuery("#field2").hide();
}
});