Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Interactive credit card using React

@quadri101

Desktop design screenshot for the Interactive card details form coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


How do you format the card number in the form to have a space every 4 letters

Community feedback

imad 3,330

@imadvv

Posted

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 helpful

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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