Skip to content

Commit

Permalink
resetting card selection when loaded so the UI will not get stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Sosnowski committed Nov 26, 2024
1 parent 3456e6a commit b8482f1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Application/views/frontend/tpl/stripecreditcard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,19 @@
//Activating card details form after load if stripe card is selected
document.addEventListener('DOMContentLoaded', function() {
$('#payment_stripecreditcard').is(':checked') && !$('#payment_stripecreditcard').parents('dt').next('dd').is(':visible') ?
$('#payment_stripecreditcard').trigger('click')
: false;
const $stripeRadio = $('#payment_stripecreditcard');
const $stripeCardDD = $stripeRadio.parents('dt').next('dd');
const $stripeUsedCardSelect = $stripeCardDD.find('#stripe_used_card');
// Ensure Stripe credit card payment option is expanded if selected
if ($stripeRadio.is(':checked') && !$stripeCardDD.is(':visible')) {
$stripeRadio.trigger('click');
}
// Reset used card selection when Stripe is selected
if ($stripeRadio.is(':checked')) {
$stripeUsedCardSelect.prop('selectedIndex', 0);
}
});
Expand Down

0 comments on commit b8482f1

Please sign in to comment.