Chrome Credit Card Expiration Autofill Format Chrome Credit Card Expiration Autofill Format google-chrome google-chrome

Chrome Credit Card Expiration Autofill Format


I ran into this same issue - checked the Chrome spec for autofill and adding autocomplete="cc-exp-year" to the form field fixed it.


you need to do 'autocomplete' => 'off' on you expiry input and then make two inputs with cc-exp-month/cc-exp-year like this:

<input id="cardform-exp" autocomplete="off" placeholder="MM / YY"><div style="opacity: 0;line-height: 1px;position:relative;">   <input id="cardform-exp-month" autocomplete="cc-exp-month" style="height:34px;width: 20px;position: absolute;top: 100px;left: 30px;z-index: -100;">   <input id="cardform-exp-year" autocomplete="cc-exp-year" style="height:34px;width: 20px;position: absolute;top: 100px;left: 80px;z-index: -100;"></div>

after with js you cut month / year and replace it to expiry input:

$("#cardform-exp").val($("#cardform-exp-month").val() + ' / ' + $("#cardform-exp-year").val().substr(2, 2) );