title: How to format and unformat dollar amounts with comma separator in javascript/jquery?
body: <p>I have tried to format dollar amount with comma separator in regex below:</p>
  
  <pre><code>$.fn.digits = function(){ 
      return this.each(function(){ 
          $(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); 
      })
  }
  
  &lt;div&gt;$1000000&lt;/div&gt;
  
  $('#divid').digits();
  </code></pre>
  
  <p>This is working fine for formatting the amount, but how to unformat the amount field?</p>
  
  <p>Is there someother simple way to do this?</p>