Question
Unable to read value of Text Field : Any help?
I've following DOM structure:
body
form
div1
div2
textfield
button
div3
button
etc.
For some reason, I am unable to read the value of the textfield. What I am doing is...on div2 I've a button, onclick this div2 is hidden & div3 comes on the front. But, on trying to read this value of textfield...(where user is supposed to enter value), I am trying this:
----------------------------------------------------------------------------------------------------------------
var divElements=document.getElementsByTagName('div');
alert(divElements[1].getElementsByTagName("input")[1].value);
----------------------------------------------------------------------------------------------------------------
Alert returns ampty alert. :(
What am I doing wrong?
Regards
Webcoder
body
form
div1
div2
textfield
button
div3
button
etc.
For some reason, I am unable to read the value of the textfield. What I am doing is...on div2 I've a button, onclick this div2 is hidden & div3 comes on the front. But, on trying to read this value of textfield...(where user is supposed to enter value), I am trying this:
----------------------------------------------------------------------------------------------------------------
var divElements=document.getElementsByTagName('div');
alert(divElements[1].getElementsByTagName("input")[1].value);
----------------------------------------------------------------------------------------------------------------
Alert returns ampty alert. :(
What am I doing wrong?
Regards
Webcoder
