Solved 4 to javascript

Posted on 2011-03-04
Last Modified: 2012-05-11
How do you read in a value from a 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.
I get this error when I run it
Microsoft JScript runtime error: Object required
Question by:Galagos1
LVL 13

Accepted Solution

agarwalrahul earned 125 total points
ID: 35041559
Instead of this.document.getElementById("txtDate1").value; use document.getElementById('<%=Test.ClientID%>').value;

Expert Comment

ID: 35041780
I think, agarwalrahul meant to use

dateValue = document.getElementById('<%=txtDate1.ClientID%>').value

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Data is not showing from images 15 37
Angular JS Route 3 47
Regular Expression 1-100 with two digits 15 22
Window.Open() is showing a blank page 9 0
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now