I have some simple multiplication and addition that I'm performing via JavaScript and outputting the result into an HTML Element on a webpage. For some reason the output seems to be a combonation of two values rather that a SUM value. I've attached a screenshot of my results.
function ccFeeCalculation(){
var payment = document.getElementById('payment_amount').value;
var fee = .03 ;
var feeAmount = (payment * fee)*1.00;
var paymentPlusFee = payment + feeAmount;
console.log("fee amount:" + paymentPlusFee);
document.getElementById("processingFee").textContent = feeAmount;
document.getElementById("processedAmount").textContent = paymentPlusFee;
}
<h2><label>Step1: Payment Amount:</label>
<input class="currencyTextBox" type="text" name="payment_amount" id="payment_amount" size="6" onKeyUp="ccFeeCalculation();" /></h3>
This amount can be changed in order to make a partial payment.<br /><br />
<div id="ccFee" style="display: none">
<font color="red"><span id="feePercentage">A 3% Fee Will Be Applied:</span> <span id="processingFee" class="currencyTextBox"></span><br>
Amount to be processed today: <span id="processedAmount" class="currencyTextBox"></span><br><br>
</font>
</div>
If my payment amount is typed as 10.00, it shows the correct fee amount of .30 but when it added the two values, the result is 10.000.3
I'm sure I'm missing something silly. Can someone shed some light?