hi
i have 2radiobutton and 1 text box
i want users can't type in text box untill they checked radiobutton2
how i can do it?
thanks
<asp:RadioButton ID="RadioButton1" runat="server" Text = "Yes" GroupName = "Radio" onclick = "Radio_Click()" /> <asp:RadioButton ID="RadioButton2" runat="server" Text = "No" GroupName = "Radio" onclick = "Radio_Click()" /> <br /><asp:TextBox ID="TextBox1" runat="server" Enabled = "false"></asp:TextBox> <script type = "text/javascript"> function Radio_Click() { var radio1 = document.getElementById("<%=RadioButton1.ClientID %>"); var textBox = document.getElementById("<%=TextBox1.ClientID %>"); textBox.disabled = !radio1.checked; textBox.focus(); } </script>
Demo
Yes No
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.