jquery .validate不验证隐藏域问题
jquery默认配置如下, 可以看出默认忽略对隐藏域的校验
defaults: {
messages: {},
groups: {},
rules: {},
errorClass: "error",
validClass: "valid",
errorElement: "label",
focusCleanup: false,
focusInvalid: true,
errorContainer: $( [] ),
errorLabelContainer: $( [] ),
onsubmit: true,
ignore: ":hidden",
ignoreTitle: false,
解决方案: 添加配置如下
form.validate().settings.ignore = "";
自定义忽略内容
form.validate().settings.ignore = ":disabled,.ignore-validate";