Reputation: 576
A client has asked to use the type="number" attribute for a credit card field in order to get the right keyboard on mobile devices, but would like some padding after every 4th character to make it look more like a credit card number. Is such a thing even possible?
Upvotes: 0
Views: 246
Reputation: 121
mask input plugin is the best option for that.
$('#creditcard').mask('0000 0000 0000 0000');
Upvotes: 2
Reputation: 21470
You can use different separate inputs, all of type 'number', and move focus between them using javascript every time the input meets your criteria (let's say: 4 characters...)
Upvotes: 0