I followed the advice in this other post and used the pattern found in the list of regular expressions used in Chrome , but for some reason Chrome still doesn't detect that my field is a credit card field.
Safari discovers this is just fine.
Here is the input HTML, as shown by the web inspector:
<input class="control" id="card_number" type="tel" name="card_number" value="" autocorrect="off" spellcheck="off" autocapitalize="off" placeholder="Card number" data-reactid=".0.1.1.0.0.5.0.0" x-autocompletetype="cc-number" autocompletetype="cc-number">
Yes, as you can see from data-reactid , I am using React. Maybe this has something to do with it. Who knows!
I set up a test page so that others can play with it. You can visit https://entire.life/payment-form-test in Safari, and (if you have autocomplete enabled and a credit card saved to it), it will appear. If you visited it in Chrome, it will not select the autocomplete option. Even after entering the first letter of your card.
This code is open source. Here you can see the source of the /payment-form-test page.
javascript google-chrome reactjs credit-card
chadoh
source share