本文介绍了如何为所有表单设置一个invalidHandler?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几种形式,它们都共享同一个无效处理程序,是否可以将其设置为网站所有形式的标准invalidHandler?
I have several form that all share the same invalid handler, is there a way to set it as the standard invalidHandler for all the forms of the website?
谢谢
推荐答案
像这样吗?
$(document).ready(function() {
jQuery.validator.setDefaults({
invalidHandler: function(form, validator) {
// your custom function
},
// any other options to set as default
});
});
http://docs.jquery.com/Plugins/Validation/Validator/setDefaults#defaults
这篇关于如何为所有表单设置一个invalidHandler?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!