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 on开发者_如何学运维e field.
You can use the element
method of the Validator object:
element( element )
Returns: BooleanValidates a single element, returns true if it is valid, false otherwise.
Example:
$("#myform").validate().element( "#myselect" );
Another way:
$("#myElement").valid();
精彩评论