Text box added using javascript doesnot respond as expected to the js attached to it.
- by Mallika Iyer
Hello,
I am adding a text box using javascript:
This is what is generated:
<dd id="text3-element" style="width: 350px;">
<input type="text" size="50" id="text3" name="text3" onblur="return getFieldValue(this.id);" value="">
</dd>
This is what is present in the getFieldValue function:
function getFieldValue(id){
var elem = document.getElementById(id);
alert(elem.value);
return false;
}
I'm trying to get the value of the field added using javascript when the value of the filed changes.
However, I keep getting the value as 'undefined', in spite of entering text into the newly added text box.
This does not happen if the form already has a text box to begin with - i.e., if a text box is not being added via a js function.
Anything missing / look wrong here?
Thanks!