Sir,
Is there a way to Show / Hide textbox on dropdown value change in .aspx form using javascript ?
<head id="Head1" runat="server"> <script type="text/javascript"> function Change(ddl) { var txt = document.getElementById("<%=TextBox1.ClientID %>"); txt.style.display = ddl.value == "1" ? "block" : "none"; } </script> </head> <body> <form id="form1" runat="server"> <asp:DropDownList ID="DropDownList1" runat="server" onchange = "Change(this)"> <asp:ListItem Text = "Show" Value = "1"></asp:ListItem> <asp:ListItem Text = "Hide" Value = "0"></asp:ListItem> </asp:DropDownList> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </form> </body> </html>
To hide TextBox simply add style to it
<asp:TextBox ID="TextBox1" runat="server" style = "display:none"></asp:TextBox>
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.