Design comparison
SolutionDesign
Solution retrospective
How do you format the card number in the form to have a space every 4 letters
Community feedback
- @imadvvPosted over 2 years ago
Greeting Quadri Shittu!! Congratulations on completing your challenge!, 👏👏👏
I didn't finish this challenge yet, but I think the easy way to add that spacing is to track the input value length and add a space to the value when hint a four number.
example function .
function addSpacing(input) { if ( input.value.length == 4 || input.value.length == 9 || input.value.length == 14 ) { input.value += " "; } }
Hope this give you some hints.
Happy Codding, have a Good Day
Marked as helpful1
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