Javascript calculation from html input id always results in 1
<p>I'm running into an error when performing a calculation on submit using javascript. The pay_amount input submits '1' and total_charged submits '4.95' regardless of what the value of pay_amount is.</p>

<p>Here is the html:</p>

<pre><code>&lt;form method="POST" action="example-post-url.php" autocomplete="off" name="form" id="form"&gt;

    &lt;input type="text" id="pay_amount" name="pay_amount" value="1,794.00"/&gt;  
    &lt;input type="hidden" id="total_charged" name="total_charged" /&gt;

    &lt;input type="submit" value="submit" onclick="submitCard();" id="submitButton"/&gt;

&lt;/form&gt;
</code></pre>

<p>Here is the javascript:</p>

<pre><code>&lt;script&gt;
    function submitCard(){

        var payment = parseFloat(document.getElementById('pay_amount').value);
        var fee = ((payment*0.035)+3.95);
        var total = payment + fee;
        document.getElementById('total_charged').value = total.toFixed(2);

        document.form.submit();
    }
&lt;/script&gt;
</code></pre>

<p>I've tried replacing var payment with the code below thinking it was an issue with commas, but I'm still running into problems.</p>

<pre><code>var payment = document.getElementById('pay_amount').value.replace(/,/g, '');
</code></pre>

<p>What in the world is going on here?</p>
