Reply To: Calculations in 2 different forms

Home Forums Quform WordPress Calculations in 2 different forms Reply To: Calculations in 2 different forms

#31293
zittis
Participant

Pls help

I added this in the html
<div id=”form-total2″></div>

Then added this code but still it doesnt work:

jQuery(function ($) {
var calculate = function () {
var total = 0;

// Week 1
if ($(‘.quform-field-6_255_1’).is(‘:checked’)) {
total += 100;
}
// Week 2
if ($(‘.quform-field-6_255_2’).is(‘:checked’)) {
total += 100;
}
// Week 3
if ($(‘.quform-field-6_255_3’).is(‘:checked’)) {
total += 100;
}
// Week 4
if ($(‘.quform-field-6_255_4’).is(‘:checked’)) {
total += 100;
}
// Week 5
if ($(‘.quform-field-6_255_5’).is(‘:checked’)) {
total += 100;
}

// Display the result to the user
$(‘#form-total2’).text(‘€’ + total);

// Set the value of the hidden field
$(‘.quform-field-6_196’).val(” + total);
};

// Calculate on page load
calculate();

// Recalculate when these checkboxes or radio buttons are clicked
$(‘.quform-field-6_255_1, .quform-field-6_255_2, .quform-field-6_255_3, .quform-field-6_255_4, .quform-field-6_255_5).click(calculate);

});

Be inspired. © 2020 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy