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

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

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?

Comment Form

Featured Sponsors


  • Curt: If anyone comes across this with similar issues I was able to sort out the pagination issues painlessly with easyCommentsPaginate from http://www.mush
  • Christopher: Yeah, it is indeed hard to do. And something remains elusive about why the pagination never worked. I tried everything I could find. Regardless, I
  • Jennifer: Hi Christopher, always hard to bug test stuff like that remotely. Sorry those didn't help. Glad you found a solution though :)

About


Advertisements