Show Hide DIV with TextBox based on RadioButton selection (checked unchecked) using JavaScript and jQuery

In this article I will explain how to show and hide HTML DIV with TextBox based RadioButton selection or click i.e. when RadioButtons are checked (selected) and unchecked (unselected) using jQuery.

When the RadioButton is clicked based on whether it is checked (selected) or unchecked (unselected), the HTML DIV with TextBox will be shown or hidden.


<span>Do you have Aadhar?</span>
<label for="chkYes">
    <input type="radio" id="chkYes" name="chkAadhar" />
<label for="chkNo">
    <input type="radio" id="chkNo" name="chkAadhar" />
<hr />
<div id="dvPassport" style="display: none">
    Aadhar Number:
    <input type="text" id="Aadhar" />


<script type="text/javascript" src=""></script>
<script type="text/javascript">
    $(function () {
        $("input[name='chkAadhar']").click(function () {
            if ($("#chkYes").is(":checked")) {
            } else {

When the RadioButton is clicked, based on Yes RadioButton is checked (selected) or unchecked (unselected), the HTML DIV with TextBox is shown or hidden.

Related Post

Latest Post

Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.