asp.net 4 to javascript

How do you read in a value from a asp.net text box in javascript.  I am not using a form.
var dateValue = new Date();
dateValue = this.document.getElementById("txtDate1").value;
reading it from this text box.
<asp:TextBox
     ID="txtDate1"
     runat="server"/>
I get this error when I run it
Microsoft JScript runtime error: Object required
Galagos1Asked:
Who is Participating?
 
Rahul AgarwalConnect With a Mentor Team LeaderCommented:
Instead of this.document.getElementById("txtDate1").value; use document.getElementById('<%=Test.ClientID%>').value;
0
 
dxdinhCommented:
I think, agarwalrahul meant to use

dateValue = document.getElementById('<%=txtDate1.ClientID%>').value
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.