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

react,vanilla css & html

mickislim 100

@mickislim

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


this is my first individual project , i decided not to use context Api and passed props down. It was challenging trying to make Error Alert display properly based on the actions performed , i used different approach for days before getting it to work properly

Community feedback

@jcbotero

Posted

Hi mickislim!. Nice code!. If you don't mind I would like to make a suggestion. I think you forgot to include a couple of things :

1.The credit card number field is not separating every 4 digits To add space every 4 digits, in your javascript sheet you can add an eventlistener that takes the id of that input, and through the .replace() method, give an instruction to place a space every 4 digits. This way:

document.getElementById("cardnumber").addEventListener('input', function (e) { e.target.value = e.target.value.replace(/[^\dA-Z]/g, '').replace(/(.{4})/g, '$1 ').trim(); });

2.The image of the credit card is not reflecting the values entered in the fields. For this, you can use javascritp to send the value from one field to the other:

document.getElementById("inputFilled").innerText = document.getElementById("imgInput").value;

This within a function, or within an eventlistener.

If you think this helped you, please mark the comment as helpful. Thank you!

0

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