searchsanjaysharma
asked on
How to enable disable panel p1 on click of radio button in jquery
Kindly correct the following code
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script language="javascript">
$(document).ready(function ($)
{
$("input[ID='r1']").click( function ()
{
if ($(this).is(':checked')) {
$('#p1').attr("disabled", false);
}
else
{
$('#p1').attr("disabled", true);
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButton ID="r1" runat="server" Text="Male" groupname="r"/>
<asp:RadioButton ID="r2" runat="server" Text="Female" GroupName="r" />
<asp:Panel ID="p1" runat="server" Enabled ="false">
</asp:Panel>
</div>
</form>
</body>
</html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script language="javascript">
$(document).ready(function
{
$("input[ID='r1']").click(
{
if ($(this).is(':checked')) {
$('#p1').attr("disabled", false);
}
else
{
$('#p1').attr("disabled", true);
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButton ID="r1" runat="server" Text="Male" groupname="r"/>
<asp:RadioButton ID="r2" runat="server" Text="Female" GroupName="r" />
<asp:Panel ID="p1" runat="server" Enabled ="false">
</asp:Panel>
</div>
</form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I dont want to play show hide, i want to enable disable panel and not div
when you're using Enabled ="false" .net don't generate the corresponding HTML in the page. Do you understand that? Please confirm.
if you don't want to generate the content go to corresponding ajax controls
if you don't want to generate the content go to corresponding ajax controls
ASKER
ok
Open in new window
By the way, the "language" attribute is obsolete. Use the "type" attribute instead:Open in new window