function paymentSentSum() {
var totalPaymentSent = 0;
var that;
$(".paymentSentSum").each(function() {
that = parseFloat(this.value.replace(/\,/g,''));
if(!isNaN(that) && that != 0) {
totalPaymentSent += that;
}
});
$("#paymentSentTotalPaymentSent").val((totalPaymentSent).formatMoney(2, '.', ','));
}
function addTrailingZerosBookings() {
var that;
$(".paymentSentSum").each(function() {
that = parseFloat(this.value.replace(/\,/g,''));
if(that && !isNaN(that)) {
//$("#" + $(this).attr('id')).val(trailingZeros(this.value));
if(isAlphaNumeric(that)) {
$("#" + $(this).attr('id')).val(that.formatMoney(2, '.', ','));
} else {
$("#" + $(this).attr('id')).val(this.value);
}
}
});
}
ここはこれを使います。金額を取得するときに最初に parseFloat を使用してから、チェックを適用しました。残りはすべて良いです。
コードペン : http://codepen.io/anon/pen/JdqLgB