Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable elements in element array

Status
Not open for further replies.

dokken

Programmer
Mar 7, 2001
61
US
I have a form that dynamically creates text input elements. The logic seems quite different if I have one text input or many. Does anybody know how to check if there is more than one element? The values of .value and .length are different depending on if there is one element or more than one.

Paul
 
you can loop through the elements array:

document.formname.elements

is an array of all the elements in a particular form jared@eae.net -
 
[tt]
Code:
for(var i=0; i<document.formname.elements.length; i++)
  alert(document.formname.elements[i].value == &quot;&quot;);
[/tt]
I hope this helped! ;-)
- Casey Winans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top