Design comparison
Solution retrospective
Good practice with some page arrangement and input validations. Wouldn't exactly put this into production but felt I covered a fair amount of bad-input error handling. Would like to implement some logic that would make the credit-card number input box space appropriately. Suggestions welcomed!
Community feedback
- @ms097530Posted about 2 years ago
What I did for handling spacing of the credit card number was add an event listener for 'input' where I removed spaces from the current input value and added spaces back in at appropriate locations. Since the 'input' event fires on deletion (single or multiple) and copy-paste it also formats appropriately at those times. Please feel free to check out my submission if you'd like to check it out - I think it worked pretty well. I've added comments for clarity, but if you decide to check it out and have questions please feel free to ask.
Cheers, Mike
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord