unplugged_web 2 Posted July 2, 2015 Report Share Posted July 2, 2015 I've added this to a site I'm working on but want the card type to be included when the form is submitted but don't know how to update the input value when the card number is entered. At the moment I've got a span class which shows the card image (done using the above example) and then the user has to select their payment method before the form will send. How do I change it so that the type is added to a hidden text field? Quote Link to post Share on other sites
dsonesuk 929 Posted July 2, 2015 Report Share Posted July 2, 2015 Most sites give a dropdown list of cards, which is not js dependant. Quote Link to post Share on other sites
justsomeguy 1,135 Posted July 2, 2015 Report Share Posted July 2, 2015 You can detect that on the server also instead of with Javascript. Visa card numbers start with a 4, for example. I'm not sure of all of the rules, but they're out there somewhere.Other than that, check the example on the Github page, it shows that you can use an event to update the card type:https://github.com/christemple/detect-card-js Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.