Safari autofill Credit Card

Claytinho picture Claytinho · Feb 19, 2014 · Viewed 7.9k times · Source

I am trying to use the code below to use "Safari's AutoFill" of the credit card. But it did not work

<input type="text" autocomplete="cc-number">
<input type="text" autocomplete="cc-name">
<input type="text" autocomplete="cc-exp-month">
<input type="text" autocomplete="cc-exp-year">
<input type="text" autocomplete="cc-csc">

Answer

Alejandro Garcia del Rio picture Alejandro Garcia del Rio · Jun 27, 2016

To make it work you need to:

  • Use any of this names: addCreditCardNumber, cardNumber, cardnumber -or- any of this ids: cardNumber, creditCardNumber, creditCardMonth, creditCardYear (there may be more ids or names that works)
  • Use an input with text type (not number type)
  • And most importantly it will only work over https

Hope this helps!