In this tutorial you will learn how to disable the asp:Textbox using javascript. I will show you how to do so in just one and simple line of javascript code. Let's have a look over it.
disable the asp:Textbox using javascript
<script type="text/javascript"> function DisableTextBox() { document.getElementById("<%=txtName.ClientID %>").disabled="disabled"; } </script> <asp:TextBox ID="txtName" runat="server" EnableTheming="false" Text="Saira Khan"></asp:TextBox> <br/><br/> <asp:Button ID="btnSubmit" runat="server" Text="Submit" Style="cursor: pointer; font-size: 12px;" OnClientClick="DisableTextBox(); return false;" />
Using the OnClientClick event of asp:button i am calling the javascript function to disable the asp:textbox . So this is the way to disable the asp:textbox using javascript.
0 comments:
Post a Comment