Mr Bell
Mr Bell

Reputation: 9366

How to force client side validation of a single element in ASP.NET MVC 3 (jQuery validation)?

How can I force the framework to validate a specific field?

I saw somewhere that I can call $("form").validate().form() to force the entire form to validate, but I only want to check just the one field.

Upvotes: 2

Views: 4110

Answers (2)

alansiqueira27
alansiqueira27

Reputation: 8506

Another way:

$("#myElement").valid();

Upvotes: 2

dtb
dtb

Reputation: 217293

You can use the element method of the Validator object:

element( element )           Returns: Boolean

Validates a single element, returns true if it is valid, false otherwise.

Example:

$("#myform").validate().element( "#myselect" );

Upvotes: 5

Related Questions