View Full Version : textarea processing problem

Apr 2nd, 2014, 06:27 AM
I have a textarea:

<textarea class="norm" id="scrptExecEntry" name="scrptExecEntry" rows="10" cols="100"></textarea>

Then I have javascript (as part of an object constructor function)

this.getTxtFieldIds = function()
var txt = document.getElementsByTagName('INPUT');
for(var i = 0; i < txt.length; i++)
if(txt[i].type == "text")
this.txtFieldIds[this.txtFieldIds.length] = txt[i].id+':text';
var ta = document.getElementsByTagName('TEXTAREA');
var len = this.txtFieldIds.length;
this.txtFieldIds[len] = ta.id+':textarea';
alert(this.txtFieldIds[len]) // -> 'undefined:textarea'
alert(' no ta')
// .... etc

The problem is that the alert dialogs come up under if(ta) but ta.id is 'undefined';
I am probably having a fit of hysterical blindness but I can't see why.
All of the code for INPUT elements works as well as expected.
Thanks for time and attention

low tech
Apr 2nd, 2014, 06:45 AM
I THINK ta is a nodelist and so requires a loop


for (var i = 0; i < ta.length; ++i){
alert("Ta Class "+ta[i].className); //norm

or this also worked for me

alert(ta[0].id); //scrptExecEntry