JQuery validate: How to add a rule for regular expression validation?

Posted by PeterTheNiceGuy on Stack Overflow See other posts from Stack Overflow or by PeterTheNiceGuy
Published on 2008-11-11T12:34:29Z Indexed on 2010/03/15 15:49 UTC
Read the original article Hit count: 621

Filed under:
|
|
|

I am new to JQuery and am using the JQuery validation plugin. Great stuff! I want to migrate my existing ASP.NET solution to use JQuery instead of the ASP.NET validators. I am missing a replacement for the regular expression validator. I want to be able to do something like this:

$("Textbox").rules("add", { regularExpression: "^[a-zA-Z'.\s]{1,40}$" })

Could anyone give me a hint how to add a custom rule to achieve this?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about validation