how to remove last comma from the string using jquery
<p>I am storing multiple selected option value to the textbox and concatenate with comma but dont want to add in last of the string. hear is my code. </p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;select id="garden" name="garden" multiple="multiple"&gt;
  &lt;option value="1"&gt;Flowers&lt;/option&gt;
  &lt;option value="2"&gt;Shrubs&lt;/option&gt;
  &lt;option value="3"&gt;Trees&lt;/option&gt;
  &lt;option value="4"&gt;Bushes&lt;/option&gt;
  &lt;option value="5"&gt;Grass&lt;/option&gt;
  &lt;option value="6"&gt;Dirt&lt;/option&gt;
&lt;/select&gt;
&lt;input type="text" name="store" id="store" /&gt;
&lt;script&gt;
$("#garden").change(function () {
  var str = "";
  $("select option:selected").each(function () {
        str += $(this).val() + ",";
      });
    $('#store').val(str).attr('rows',str.length) ;
})
.trigger('change');
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
