card
card copied to clipboard
Expiry month and year with two select fields
Hello, is there any solution to the input SELECT problem not being recognized?
I would like to use two selects one for month and one for year. Apparently the page "witcherstore.com" solve the problem.
Not sure what problem you're having with this; I've not seen any issues when implementing it 🤔
Everything works smoothly except the select. I am using this example code:
formSelectors: { numberInput: 'input[name="CARD"]', nameInput: 'input[name="CARD_NAME"]', expiryInput: 'select[name="CARD_2"], select[name="CARD_3"]', cvcInput: 'input[name="CARD_CODE"]' },
<select name="CARD_2" id="CARD_2"> </select>
<select name="CARD_3" id="CARD_3"> </select>
Same problem here. It works with one or two inputs, but not with select.
YES, the site "witcherstore.com" solved the problem and was able to use select in the month / year payment field, but I did not figure out how.
Hey guys, solve that out just change the selector vars and have fun
$(function(){
year_selector = 'select[name="data[Source][exp_year]"]';
month_selector = 'select[name="data[Source][exp_month]"]';
$(month_selector).change(function(){
year = $(year_selector).val() == '' ? '••' : $(year_selector).val();
$('.jp-card-expiry').text($(this).val()+'/'+year);
});
$(year_selector).change(function(){
month = $(month_selector).val() == '' ? '••': $(month_selector).val();
$('.jp-card-expiry').text(month+'/'+$(this).val());
});
$(month_selector).add(year_selector).on('focus', function(){
$('.jp-card-expiry').addClass('jp-card-focused');
}).on('blur', function(){
$('.jp-card-expiry').removeClass('jp-card-focused');
});
});
@nancorrea - I think you're missing the the () to invoke your IIFE, or am I missing something?
This worked for me. Sucks this has to be a work around
Thats it. Thanx
Bump. I'm having the same issue here. The vast majority of credit card expiration fields out there use select elements. As such, the developer should update Card to allow for them.