using a custom jQuery validation class

I have some custom validation I'd like to do with jQuery. jQuery validation comes out of the box with a 'required' class. This means that I can have a script declaring


and the next textbox will validate correctly, based on the class 'required' I add to it:

<input type="text" value="" name="flowstatus" id="flowstatus" class="required">

My new validation rule is: the text in a textbox should be between 15 and 50 chars long. Is there a way to create my own custom rule/class to implement something like

<input type="text" value="" name="flowstatus" id="flowstatus" class="from15to50">

Note: This is NOT what I need:

    rules: {
        flowstatus: {required: true, minlength: 15, maxlength: 50}

This last script is too tightly coupled to the fields I want to validate.


I'm pretty sure that you can add an attribute to the desired element defining its min and max lengths. Something like:

<input type="text" value="" name="flowstatus" id="flowstatus" class="required" minlength="15" maxlength="50">

I'm not quite sure about the custom class solution, however.

Need Your Help

OR vs || conditions

c# condition

I just started using Vb.Net. I'm used to C# syntax. I know that I can do this in C# :

reusing dialog box

c++ visual-studio-2010 resources

I have a dialog box from an old program that I would like to reuse, but I can't find an easy way to import/export it.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.