Set asp.net textbox value using javascript
asp.net, javascript
Solution
Solution 1:
Make that textbox as visible=true and try,
When you make a control as visible false, that control will not be loaded in client side and as you knew javascript will be executed on client side itself.
Solution 2:
Add this javascript at the end of the page.
Problem
I want to set the value of a asp.net textbox using javascript My JS Code is: ``` document.getElementById('<%=txtFlag.ClientID %>').value = "Track"; ``` My textbox is: ``` <asp:TextBox ID="txtFlag" runat="server" Visible="False"></asp:TextBox> ``` But it gives me an error `document.getElementById(...)' is null or not an object` I dont understand what is wrong. Please help.