title: Can not pass html array to JS
body: <p>Hi I'm having trouble sending html form array to JS. I have dynamic html form and some fields:</p>
  
  <pre><code>&lt;div id="fields"&gt;
  &lt;input type="text" name="ppav[]" id="p" /&gt;
  &lt;input type="text" name="quantity[]" id="q" size="3" /&gt;
  &lt;input type="text" name="price[]" id="pr" size="10" /&gt;
  &lt;input type="text" name="sum" id="su" size="10" disabled="disabled"/&gt;
  &lt;br /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>in JS i tried using this function but getting <code>undefined</code> alert instead of result:</p>
  
  <pre><code>var welements = document.getElementsByName('ppav[]');
  for (var i = 0, j = welements.length; i &lt; j; i++) {
      var an_element = welements[i];
      alert(an_element.selectedIndex);
  }
  </code></pre>