Design comparison
Solution retrospective
Feedback is appreciated.
Community feedback
- @MasonBoomPosted about 2 years ago
Hello,
Although this is a very well done project, there is always room for improvement.
I noticed that the only required fields are the exp.date and the cvc. shouldn't all areas be required?
Also, I noticed I was able to add letters in the card number, cvc, and exp.date. You can fix this by adding the following code to those input tags in the html file:
type="tel" inputmode="numeric" pattern="[0-9]*"
This next part is optional, but you can also format the credit card number so it automatically adds a space every 4 digits by using this function:
const cardNumberFormat = (number) => { return number.replace(/(\d{4})/g, '$1 ').trim() }
Hope this helps!
0
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