JSFiddle - React, Tailwind, and code Playground
HTML
<p>Show textboxes
<input type="radio" name="radio1" id="r1" value="Show" onClick="getResults()">Do nothing
<input type="radio" name="radio1" id="r2" value="Nothing">
</p>Wonderful textboxes:
<div class="text">
<p>Textbox #1
<input type="text" name="text1" id="text1" maxlength="30">
</p>
</div>
<div class="text">
<p>Textbox #2
<input type="text" name="text2" id="text2" maxlength="30">
</p>
</div>
<div class="remaining" style="display:none;">
<input type="text" />
JavaScript
$(document).ready(function () {
$(".text").hide();
$("#r1").click(function () {
$(".text").show();
});
$("#r2").click(function () {
$(".text").hide();
});
});
var flag = false;
$(".text input:text").on('blur', function () {
$(".text input:text").each(function () {
if ($(this).val() != "") {
flag = true;
} else {
flag = false;
}
})
if (flag) $(".remaining").show();
else $(".remaining").hide();
})