Jump to content

Updating value of text field


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...