my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes getElementById( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "getElementById("flight_no") returns undefined" Watch "getElementById("flight_no") returns undefined" New topic
Author

getElementById("flight_no") returns undefined

nilesh beit
Greenhorn

Joined: Feb 04, 2009
Posts: 13
Respected members
I have a Div tag named 'composeplan' which on clicking on a button displays a few textboxes. i used innerHTML to replace contents in div tag with html text for creating Textboxes using <input type="text" > etc to display those textboxes
Now when i try to read value in textbox using its id like document.getElementById("flight_no") i get 'undefined' as value
I tried document.getElementById("flight_no").value still output 'undefined'
document.getElementById("flight_no").id returns 'flight_no' i.e id of text box

Can please suggest some solution to read value from textbox.

Thanks
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



How do you define the textbox ? do you have "id" attribute for it ?

like <input .. id=" " .. name=" " >

Post your code otherwise.
nilesh beit
Greenhorn

Joined: Feb 04, 2009
Posts: 13
Hello
This is code similar to what m trying to do
The problem is readContents shows 'undefined'
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Aditya Keyal
Ranch Hand

Joined: Dec 01, 2008
Posts: 71
Which browser are you using. When i try the above code in IE7 it works perfectly fine.


- Aditya Webservices Blog
nilesh beit
Greenhorn

Joined: Feb 04, 2009
Posts: 13

Solved it

Damn it was Eclipse bug . It typed .value as .Value in document.getElementById("name").value
The V instead of v which made all mess.
Thanks for the responses.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getElementById("flight_no") returns undefined
 
Similar Threads
does firefox have a problem with .setAttribute ?
Problem in integrating Single GWt Textboxs in jsp
readonly field value change
how to take javascript array values in php form
Changing the text inside the first TextBox , the last div gets updated