title: How to get length in Javascript of an array of Form text fields
body: <p>I have this HTML code:</p>
  
  <pre><code>&lt;form id="form1" name="form1" method="post" action=""&gt;
  a &lt;input type="text" name="item[]" value="1" /&gt; &lt;br /&gt;
  b &lt;input type="text" name="item[]" value="1" /&gt; &lt;br /&gt;
  c &lt;input type="text" name="item[]" value="1" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I can't seem to pro grammatically pull the length out of the text fields array , is there some obvious plain JavaScript way (no Jquery please) to do this? I tried</p>
  
  <pre><code>    &lt;script language="javascript"&gt;
  //Tried these combination
  alert(document.form1.item.length);
  alert(document.form1.item[].length);
  alert(document.form1.elements['item'].length);
  alert(document.form1.elements['item[]'].length);
  &lt;/script&gt;
  </code></pre>