Response title
This is preview!
jQuery(document).ready(function() { /* BS(2020-07-28) - Hide the Billing Information section when selecting the Payfast Gateway and then show it again when selecting Bank Transfer Additionally, make sure that all fields are filled in if Bank Transfer is selected. */ if (jQuery('form.pmpro_form').length) { //first check if the registration form exists and only then execute jQuery("#pmpro_billing_address_fields").hide(); // Hide the billing information fields as we assume the user will pay via PayFast jQuery('#pmpro_btn-submit').attr('disabled', 'disabled'); //Set the Submit button to disabled on page load until client has entered payment details. jQuery("input[name='gateway']").change(function() { if (jQuery("input[name='gateway']:checked").val() == 'payfast') { jQuery("#pmpro_billing_address_fields input").val(""); // Clear the billing info fields because we won't be using them now that the user has selected PayFast. jQuery("#pmpro_billing_address_fields").hide(); // Go ahead and hide the billing fields because we don't want to confuse the end user. jQuery('#pmpro_btn-submit').attr('disabled', 'disabled'); } else if (jQuery("input[name='gateway']:checked").val() == 'check') { jQuery("#AccountNumber, #CVV").val("") jQuery("#pmpro_billing_address_fields").show(); jQuery('#pmpro_btn-submit').attr('disabled', 'disabled'); } }); jQuery("#pmpro_payment_information_fields input:not(#CardType,#discount_code,#discount_code_button),#pmpro_billing_address_fields input:not(#baddress2) ").on('keyup',function () { if (jQuery("input[name='gateway']:checked").val() == 'payfast') { var toValidate = jQuery('#AccountNumber, #CVV'), valid = false; toValidate.on('keyup', function () { if (jQuery(this).val().length > 0) { jQuery(this).data('valid', true); } else { jQuery(this).data('valid', false); } toValidate.each(function () { if (jQuery(this).data('valid') == true) { valid = true; } else { valid = false; } }); if (valid === true) { jQuery("#pmpro_btn-submit").prop('disabled', false); } else { jQuery("#pmpro_btn-submit").prop('disabled', true); } }); } else if (jQuery("input[name='gateway']:checked").val() == 'check') { var toValidate = jQuery('#blastname,#baddress1,#bcity,#bstate,#bzipcode,#bphone'), valid = false; toValidate.on('keyup',function () { if (jQuery(this).val().length > 0) { jQuery(this).data('valid', true); } else { jQuery(this).data('valid', false); } toValidate.each(function () { if (jQuery(this).data('valid') == true) { valid = true; } else { valid = false; } }); if (valid === true) { jQuery("#pmpro_btn-submit").prop('disabled', false); } else { jQuery("#pmpro_btn-submit").prop('disabled', true); } }); } }); jQuery("#pmpro_form").find("span.pmpro_asterisk").each(function() { jQuery(jQuery(this).closest("div").find("label:not(label.pmprorh_checkbox_label)")).append(jQuery(this)); }); jQuery(jQuery("#pmpro_billing_address_fields, #pmpro_payment_information_fields").find("label:not(label[for=baddress2])")).append(" <span class=\"pmpro_asterisk\"><abbr title=\"Required Field\">*</abbr></span>"); } });
jQuery("#pmpro_payment_information_fields input:not(#CardType,#discount_code,#discount_code_button),#pmpro_billing_address_fields input:not(#baddress2) ").on('keyup',function () {
I have tried various different variations of the selectors to try and get the first one to work but nothing helps. it is ALWAYS only working on all the fields except the first one.
Can anyone give me some guidance on why this is happening??
Thanks in advance
© 2013 jQuery Foundation
Sponsored by and others.