scriptygoddess

07 Sep, 2008

jQuery Method for Validation Plugin – "field must include at least one number"

Posted by: Jennifer In: jquery

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");

1 Response to "jQuery Method for Validation Plugin – "field must include at least one number""

1 | Fred Campbell

February 27th, 2009 at 8:57 am

Avatar

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?

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements