How to take textbox value in javascript
-
</C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript
-
</C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript
var textValue = document.getElementById('txtComments').innerText;
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
var textValue = document.getElementById('txtComments').innerText;
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
</C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript
var textValue = document.getElementById('<%txtComments.ClientID%>').value;
-
var textValue = document.getElementById('<%txtComments.ClientID%>').value;
-
</C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript
What are you using is it gridView ?
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog
-
</C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript
i forgot to add '=' symbol after '<%' take below like working var textValue = document.getElementById('<%=txtComments.ClientID%>').value; This is Example simple code to check, you take new page add the code after page directive run this page u will find the output . for futher help contact sk.haneef@gmail.com Untitled Page
alert(document.getElementById('<%=txtComments.ClientID%>')); var textValue = document.getElementById('<%=txtComments.ClientID%>').value; alert(textValue);