title: jQuery push array inserts comma
body: <p>I have few select boxes with same class. But when I use jQuery array push method to get all selected values in that class as an array it simply adds a comma (,) before each values.
  It works fins with static values. Issue is when I add values to select box from a PHP array.
  Here is how my select boxes code looks like</p>
  
  <pre><code>&lt;select name="add_purch_item1" class="add_purch_item"&gt;
      &lt;option value=""&gt;----select----&lt;/option&gt;
      &lt;?php if(!empty($pro_list1)) { foreach($pro_list1 as $products) { ?&gt;
          &lt;option value="&lt;?php echo $products-&gt;sku; ?&gt;"&gt;&lt;?php echo $products-&gt;product_name; ?&gt;&lt;/option&gt;
      &lt;?php } } ?&gt;
  &lt;/select&gt;
  
  &lt;select name="add_purch_item2" class="add_purch_item"&gt;
      &lt;option value=""&gt;----select----&lt;/option&gt;
      &lt;?php if(!empty($pro_list2)) { foreach($pro_list2 as $products) { ?&gt;
          &lt;option value="&lt;?php echo $products-&gt;sku; ?&gt;"&gt;&lt;?php echo $products-&gt;product_name; ?&gt;&lt;/option&gt;
      &lt;?php } } ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>And I have added a click function to a button. When clicks it will get all selected values as an array. here is my jQuery code,</p>
  
  <pre><code>var selected = [];
  
      $('.add_purch_item').each(function () {
          selected.push($(this).val());
      });
  
      alert(selected);
  </code></pre>
  
  <p>And when I try select box with static values it gives correct output. <strong><a href="http://jsfiddle.net/joelsays/88nps80a/" rel="nofollow noreferrer">See here an example</a></strong></p>
  
  <p>I am getting this wrong output in dynamic values. That unwanted comma is my issue. How to avoid that? I have tried string replace too.
  <img src="https://i.stack.imgur.com/wSjIx.png" alt="Wrong Output"></p>