Replacing commas in textareas with jquery or javascript
<p>I have a form with multiple text areas. </p>

<pre><code>&lt;textarea name="datasetname_1" cols="40" rows="5" id="datasetname_1" class="validate[required] text-input"&gt;&lt;/textarea&gt;&lt;br&gt;
&lt;textarea name="datasetname_2" cols="40" rows="5" id="datasetname_2" class="validate[required] text-input"&gt;&lt;/textarea&gt;&lt;br&gt;
&lt;textarea name="datasetname_3" cols="40" rows="5" id="datasetname_3" class="validate[required] text-input"&gt;&lt;/textarea&gt;&lt;br&gt;
</code></pre>

<p>I would like to replace any text that contains commas with dashes. This should work for text that's typed directly in the text areas or text that is pasted over. The text should be replaced before the form is submitted. How can I accommplish this with jquery or javascript?</p>

<p>I have tried this</p>

<pre><code>    $("#formID").submit(function() {
  $("textarea").each(function() {
($(this).val().replace(',','-'));
  });
  });
</code></pre>

<p>with no luck.</p>
