unplugged_web Posted July 2, 2015 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? Link to comment Share on other sites More sharing options...
dsonesuk Posted July 2, 2015 Share Posted July 2, 2015 Most sites give a dropdown list of cards, which is not js dependant. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 2, 2015 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now