jQuery get remaining OPTION values in CSV format
<p>I'm looking to return a CSV formatted string to set the value of a input text field with the OPTION values from a SELECT box.</p>

<blockquote>
  <p>$.map($('#addedchargeamtid option'),
  function(e) {    var exp =
  $(e).text();    alert(exp); })</p>
</blockquote>

<p>In using a map function but it looks to overwrite the value each time. can't figure out how to concat these together somehow. </p>

<p>BTW thanks to all the jQuery Gurus today, much props on my issues!!!</p>

<p>UPDATING:</p>

<pre><code>&lt;option value="123"&gt;123&lt;/option&gt;
&lt;option value="asd"&gt;asd&lt;/option&gt;
&lt;option value="trr"&gt;trr&lt;/option&gt;
&lt;option value="345"&gt;345&lt;/option&gt;
</code></pre>

<p>I need this:</p>

<p><strong>123,asd,trr,345</strong></p>

<p>But the options are dynamic and can be added or removed, so there could be 1 or 100</p>

<p>NEW:</p>

<p>Well this is kinda working. it gives me 4 options of the same item when I only added it once. also does not update the hidden text field with the CSV value</p>

<pre><code>// Add remove button
$('#addButton').click(function() {
   $('#removeButton').show();

   // Add 
   var myOptions = $('#typedchargeamtid').val();
   $.each(myOptions, function() {
      $('#addedchargeamtid').append(
         $('&lt;option&gt;&lt;/option&gt;').val(myOptions).html(myOptions)
      );
   });

   var txt = $('#addedchargeamtid').val() || [];
      $('#commasepchargeamtid').val(txt.join(','));
   });
</code></pre>

<p>Thanks again</p>
