开发者

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

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

Example:

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


Another way:

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜