title: sum values of a javascript array?
body: <p>I have looked at a lot of different varriations of this question but i cant seem to find one that is particular to what i am doing.</p>
  
  <p>I have input fields that are dynamicaly created by a php/mysql query. the values are numbers and they share a common class</p>
  
  <pre><code>&lt;?php
     foreach ($garment_sizes as $key =&gt;$value){echo '&lt;input type="number" class="size_select" name="'.$value.'" onchange="qty_update()"/&gt;&lt;label class="size_label"&gt;'. strtoupper($value).'&lt;/label&gt;';
     }
  ?&gt;
  </code></pre>
  
  <p>Resulting HTML:</p>
  
  <pre><code>&lt;input type="number" class="size_select" name="s" onchange="qty_update()"/&gt;
  &lt;label class="size_label"&gt;S&lt;/label&gt;
  &lt;input type="number" class="size_select" name="m" onchange="qty_update()"/&gt;
  &lt;label class="size_label"&gt;M&lt;/label&gt; &lt;!-- etc --&gt;
  </code></pre>
  
  <p>I want to create a function to sum all the fields with this class "size_select"</p>
  
  <pre><code>function qty_update(){
      var values = $('.size_select').serializeArray();
      //having trouble writing the loop here to sum the array..
  }
  </code></pre>