Lately I’ve been working on a checkout form that wasn’t getting autocompleted with LastPass. Curious, I went exploring. After looking at the DOM of BandCamp’s checkout form, which integrates nicely with LastPass, the solution became clear. LastPass needs some identifier to know that a given field pertains to a given aspect of a credit card. All you have to do is give an input or select element a sensible class name and then LastPass will do its magic.1 These are the classnames I’ve found that work:
- Credit card:
- Expiration month:
- Expiration year:
That’s all there is to it.
- It’s bizarre that I can’t find any documentation from LastPass about how this works, but upon reflection I think I know the reason. LastPass is used to every input element having a
nameattribute, and any reasonable developer would be giving these input elements a name that binds to a backend model with a standard naming convention for checkout. For example, an input for expiration month would have to have a
nameattribute that made it clear that this is what it was. The problem with having a