From 67ddfab1635b008d1205592b1bd74cb3a497742a Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Fri, 7 Feb 2020 19:45:32 +0000 Subject: [PATCH] Make the 'billing address is the same' checkbox respond to the change event --- templates/CRM/Core/BillingBlock.tpl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/templates/CRM/Core/BillingBlock.tpl b/templates/CRM/Core/BillingBlock.tpl index f93dda3b6a..f8bb2088f5 100644 --- a/templates/CRM/Core/BillingBlock.tpl +++ b/templates/CRM/Core/BillingBlock.tpl @@ -158,10 +158,18 @@ }); } - // toggle show/hide - $('#billingcheckbox').click(function () { - if (this.checked) { + var billingCheckboxElement = $('#billingcheckbox'); + billingCheckboxElement.click(function() { + billingCheckboxChanged(billingCheckboxElement); + }); + + billingCheckboxElement.change(function() { + billingCheckboxChanged(billingCheckboxElement); + }); + + function billingCheckboxChanged(billingCheckbox) { + if (billingCheckbox.prop('checked')) { if (!CRM.billing || CRM.billing.billingProfileIsHideable) { $('.billing_name_address-group').hide(200); } @@ -180,7 +188,7 @@ } else { $('.billing_name_address-group').show(200); } - }); + } // remove spaces, dashes from credit card number $('#credit_card_number').change(function () { -- 2.25.1