searchsanjaysharma
asked on
How to enable disable textbox with radio button in following code.
I want to enable the textbox if either r1 or r2 is clicked else it should remain disabed
<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')) {
$('#t1').attr("disabled", false);
}
else
{
$('#t1').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:TextBox ID="t1" runat="server" Enabled="false"></asp:Text Box>
</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')) {
$('#t1').attr("disabled", false);
}
else
{
$('#t1').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:TextBox ID="t1" runat="server" Enabled="false"></asp:Text
</div>
</form>
</body>
</html>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why the "B" ?
ASKER