Credit Card validation with Jquery

前端 未结 3 1039
情深已故
情深已故 2021-01-06 00:09

I\'m trying to validate credit card numbers with jQuery but i dont want to use the validation plugin , is there any other plugin for doing this?

3条回答
  •  迷失自我
    2021-01-06 00:51

    I recommend you to use Regular expression... You can check my repository I have a code snippet to validate Visa, Master card, Discovery, american express and the Security code

    https://github.com/leojavier/RegexCollection


    Remember... just because you limit the amount of digits doesn't mean it will be right.

    for instance:
    - All Visa card numbers start with a 4. New cards have 16 digits.
    - All MasterCard numbers start with the numbers 51 through 55. All have 16 digits. and so on...

    The index.html is a sample, to show you how you can use it! Feel free to write me if you have any questions :)

提交回复
热议问题