jQuery Method for Validation Plugin – "field must include at least one number"
Here's a method you can use with the validation jQuery plugin to make sure a field (like a password field) includes at least one number.
$.validator.addMethod("atleastonedigit", function(pass) {
if (pass == "") {
return true;
}
return ((/[0-9]+/).test(pass));
}, "This field must contain at least one number");
February 27th, 2009 at 8:57 am
I am trying to find a way of having a pre determined series of passwords where you set the exact content – not just 1 number. Any ideas?