Skip to content

Commit

Permalink
variable names updated js
Browse files Browse the repository at this point in the history
  • Loading branch information
Barny-Thorpe committed Apr 2, 2024
1 parent b17d166 commit bd90a07
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions public/js/gf-giftaid-field-frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ function initGiftAid() {
return;
}
window.gform.addAction('gform_input_change', function (elem) {
const value = elem.value;
const valueFloat = parseFloat(value);
const giftAidFloat = valueFloat * 1.25;
const donation = valueFloat.toFixed(2);
const giftAidAmount = giftAidFloat.toFixed(2);
if (!donation || !giftAidAmount) {
const donationValue = parseFloat(elem.value);
const giftAidValue = donationValue * 1.25;
const donationRounded = donationValue.toFixed(2);
const giftAidRounded = giftAidValue.toFixed(2);
if (!donationRounded || !giftAidRounded) {
return;
}
updateGiftAidDisplay(gravityForm, donation, giftAidAmount);
updateGiftAidDisplay(gravityForm, donationRounded, giftAidRounded);
}, 10);
}

Expand Down

0 comments on commit bd90a07

Please sign in to comment.