Home › Forums › Quform WordPress › Validate Field › Reply To: Validate Field
Hello ally, I used the code below to make the calculation, but the calculation ignores the point, and the comma.
how can i fix this?
jQuery(function ($) {
var calculate = function () {
var total = 0;
var val4 = $('.quform-field-5_3').val();
var val5 = $('.quform-field-5_4').val();
if (val4 && val4.length && val5 && val5.length ) {
total += parseFloat(val4);
total += parseFloat(val5);
}
// Display the result to the user
$('#form-total').text('Total: $' + total);
// Set the value of the hidden field
$('.quform-field-5_6').val('$' + total);
};
// Calculate on page load
calculate();
// Recalculate when these text input fields are changed
$('.quform-field-5_3').on('keyup blur', calculate);
$('.quform-field-5_4').on('keyup blur', calculate);
});
jQuery(function ($) {
if ($.fn.mask) {
$('.quform-field-5_3').mask('#.##0,00', {reverse: true});
}
});
jQuery(function ($) {
if ($.fn.mask) {
$('.quform-field-5_4').mask('#.##0,00', {reverse: true});
}
});