Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
87
rated 0 times [  93] [ 6]  / answers: 1 / hits: 16353  / 15 Years ago, wed, january 20, 2010, 12:00:00

Suppose I have an ASP.NET Text Box as Below :



<asp:TextBox ID=txtQuantity runat=server Text=0></asp:TextBox>


I want to get this box's current value in javascript. How can I access this element?


More From » asp.net

 Answers
27

use the clientID property



document.getElementByID('<%=txtQuantity.ClientID %>')


More information here



you can also use find



Quoted from the above link:




Additionaly the ClientID is used in
ASP.NET Ajax as the unique identifier
of client-side controls. Thus the
following JavaScript statement is
commonly used:



var control = $find(<%=
MyControl1.ClientID %>);



[#97787] Sunday, January 17, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tylerdamiena

Total Points: 139
Total Questions: 90
Total Answers: 118

Location: Liechtenstein
Member since Wed, Dec 8, 2021
3 Years ago
tylerdamiena questions
;