开发者

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

开发者 https://www.devze.com 2023-03-27 18:11 出处:网络
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开

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: Boolean

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

Example:

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


Another way:

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

精彩评论

暂无评论...
验证码 换一张
取 消