• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getElementById("flight_no") returns undefined

 
nilesh beit
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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

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

Post your code otherwise.
 
nilesh beit
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
This is code similar to what m trying to do
The problem is readContents shows 'undefined'
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Aditya Keyal
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which browser are you using. When i try the above code in IE7 it works perfectly fine.
 
nilesh beit
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic