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>
|