JSFiddle - React, Tailwind, and code Playground
HTML
<form action="">
<label for="yes">
<input id="yes" type="radio" name="question" value="0" />Yes</label>
<label for="no">
<input id="no" type="radio" name="question" value="1" />No</label>
</form>
<br />
<div class="yes display-none">Yes</div>
<div class="no display-none">No</div>
CSS
.display-none {
display:none;
}
JavaScript
(function (radioName, yesbox, nobox) {
$('input[name="' + radioName + '"]').click(function () {
if ($(this).val() == 0) {
$(nobox).hide();
$(yesbox).show();
} else {
$(nobox).show();
$(yesbox).hide();
}
});
})("question", ".yes", ".no");