How to retrieve value from asp.net textbox from javascript?

Posted by Clean on Stack Overflow See other posts from Stack Overflow or by Clean
Published on 2010-05-05T09:58:15Z Indexed on 2010/05/05 10:08 UTC
Read the original article Hit count: 196

Filed under:
|

Hi,

I have an asp.net web form with a couple of asp.net textbox controls:

<asp:TextBox ID="txtTextBox" runat="server" /> .

I have a javascript file tools.js that are included in the page:

<script src="tools.js" type="text/javascript"></script>

How can I access the value from txtTextBox from javascript?

Ive tried using

document.getElementById('<%= txtTextBox.ClienID %>').value;
document.getElementById('<%= txtTextBox.UniqueID %>').value;
document.getElementById('<%= txtTextBox %>').value;

but none of them works.

Any ideas?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript