CODEDIGEST
Home » CodeDigest
Search
 

Technologies
 

Show and Hide DIV tag based on Checkbox selection using JQuery in Asp.Net
Submitted By Satheesh Babu B
On 12/12/2008 6:55:16 AM
Tags: CodeDigest,Jquery  

Show and Hide DIV tag based on Checkbox selection using JQuery in ASP.Net
 

There are situations where we need to show and hide div tag based on some conditions in client side.

 

The following code snippet will help us to hide and show a div tag based on checkbox selection using jquery.

 

<script language="javascript">

          function EnableDisableDIV() {

              if ($("#chkShowPersonal").attr("checked")) {

                  $("#dvPersonal").show();

              } else {

              $("#dvPersonal").hide();

              }             

          }         

      </script>

 

 <asp:CheckBox ID="chkShowPersonal"  onclick="EnableDisableDIV()" runat="server" />

        <div id="dvPersonal" style="display:none">

            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>

        </div>

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..