Jump to content

Updating value of text field


unplugged_web

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...