Link to home
Start Free TrialLog in
Avatar of Mark Steggles
Mark StegglesFlag for United States of America

asked on

jquery custom credit card validation

Hello,

I'm using jquery validate script and was using creditcard method. Now my client has obfuscated the credit card number if someone goes to edit their credit card info. Obfuscated with *****'s

So, I need a custom validation for jquery validate script to check for

credit card number or ***********'s + last 4 digits

Any ideas?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try this also
$('#creditCardNumber').valid8({
    'regularExpressions': [
        { expression: /^[\*]+[0-9]{4}$/, errormessage: 'Credit card number is not valid'}
    ]
});

download this package from here
http://www.unwrongest.com/projects/valid8/#
You can use the this extra functionality for the full credit card number

http://www.ihwy.com/Labs/jquery-validate-credit-card-extension.aspx



Avatar of Mark Steggles

ASKER

Thankyou Gurvinder32,

This [\*]+[0-9]{4} works on ***********4123

but it also needs to work for digits only 123123123123123123

what would be the update to make it work for that aswell?

Thanks
solution was not complete
This should allow either:

var re = /^(\*+|\d+)\d{4}$/;
Thank you Kravimir, I will give that a whirl