Forum Moderators: open

Message Too Old, No Replies

count input text array

         

brnco

11:37 am on Oct 10, 2007 (gmt 0)

10+ Year Member



I have an input text array which is varible. So the number of INPUT tags can vary. I woul like to get the number size of an Array.

Thanks in advance for your help.

<input name="array[]" type="text" value="" />

penders

11:50 am on Oct 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The following will return the number of all INPUT elements in the whole document, regardless of 'type':

count = document.getElementsByTagName('input').length;

If the number of other INPUTs is fixed then you could simply deduct this figure, or you'll need to step through this array and manually count the number INPUT elements of type == 'text'.

daveVk

11:59 am on Oct 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



could also try

count = document.getElementsByName("array[]").length;

brnco

12:11 pm on Oct 10, 2007 (gmt 0)

10+ Year Member



Problem solved.

Many Thanks