Elements to ignore when validating, simply filtering them out. jQuery's not-method is used, therefore everything that is accepted by not() can be passed as this option. Inputs of type submit and reset are always ignored, so are disabled elements.
Example: Ignores all elements with the class "ignore" when validating.
$("#myform").validate({ ignore: ".ignore" });highlight (default: Adds errorClass (see the option) to the element )
Type: ()
How to highlight invalid fields. Override to decide which fields and how to highlight.
Example: Adds the error class to both the invalid element and its label
$("#myform").validate({ highlight: function(element, errorClass, validClass) { $(element).addClass(errorClass).removeClass(validClass); $(element.form).find("label[for=" + element.id + "]") .addClass(errorClass); }, unhighlight: function(element, errorClass, validClass) { $(element).removeClass(errorClass).addClass(validClass); $(element.form).find("label[for=" + element.id + "]") .removeClass(errorClass); } })The callback gets passed three arguments:
Type:
The invalid DOM element, usually an input .
Type:
Current value of the errorClass option.
Type:
Current value of the validClass option.
unhighlight (default: Removes the errorClass )
Type: ()
Called to revert changes made by option highlight, same arguments as highlight.
分享给小伙伴们:
本文标签: Jquery.valid,validate.js,validate,表单验证/">Jquery.valid,validate.js,validate,表单验证
相关文章
发表评论愿您的每句评论,都能给大家的生活添色彩,带来共鸣,带来思索,带来快乐。
本类最热新闻