title: Iterating through elements of the same class in jquery
body: <p>I have a collection of div's belonging to the same class and
  having form fields. I want to be able to iterate through the div's 
  of the same class and get the hidden form elements and store in array.</p>
  
  <p>i have created and array object that adds to an array after each iteration
  but i think where i am getting it wrong is the iteration through the div's
  Here is the structure</p>
  
  <pre><code>&lt;div class="parent_div"&gt;
      &lt;div class="child_div" id="child_div_1" number="1"&gt;
          &lt;div class="some_other_div"&gt;
          &lt;/div&gt;
          &lt;input id="name_1" type=hidden value="1.0"/&gt;
          &lt;input id="name_2" type=hidden value="4.0"/&gt;
      &lt;/div&gt;
      &lt;div class="child_div" id="child_div_2" number="2"&gt;
          &lt;div class="some_other_div"&gt;
          &lt;/div&gt;
          &lt;input id="name_2_1" type=hidden value="1.0"/&gt;
          &lt;input id="name_2_2" type=hidden value="4.0"/&gt;
      &lt;/div&gt;
      &lt;div class="child_div" id="child_div_3" number="3"&gt;
          &lt;div class="some_other_div"&gt;
          &lt;/div&gt;
          &lt;input id="name_3_1" type=hidden value="1.0"/&gt;
          &lt;input id="name_3_2" type=hidden value="4.0"/&gt;
      &lt;/div&gt;
  &lt;/div&gt;//end of parent div
  </code></pre>
  
  <p>I have written the jQuery code below to iterate through these div but I just don't know what I'm doing wrong. So PLEASE HELP!</p>
  
  <pre><code>function doSomething() {
      var array = {};
      var rowCount = $("div .child_div").length;
      var rowNumber = 0;
      for (i=0; i &lt;= rowCount; i++) {
          //doing something...
          array[i] = arrayObj (val1,val2,val3,val4,val5,val6);
      }
  }
  </code></pre>