jQuery Validate-隐藏显示验证错误消息/显示自​​定义错误 [英] jQuery Validate - Hide display validation error messages / show custom errors

查看:104
本文介绍了jQuery Validate-隐藏显示验证错误消息/显示自​​定义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery Validate,但是我真的不想有任何错误消息.相反,我需要在有问题的输入/选择/等周围有红色框.这些红色框可谓小菜一碟,但我仍然无法自行删除错误消息.如何完全禁用它们?

I'm using jQuery Validate, but I really don't want to have any error messages whatsoever. Rather, I need to have red boxes around offending inputs/selects/etc. These red boxes were a piece of cake to add, but I still cannot remove error messages themselves. How do I disable them altogether?

推荐答案

使用自定义错误放置功能(请参阅插件的选项)不会将错误消息附加到任何内容.

Use a custom error placement function (see the plugin's options) that doesn't append the error message to anything.

$('#form').validate({
  errorPlacement: function(error,element) {
    return true;
  }
});

或者您可以将错误消息放在页面的其他位置-在页面顶部的DIV中说.

Or you could put the error messages elsewhere on the page - say in a DIV at the top of the page.

这篇关于jQuery Validate-隐藏显示验证错误消息/显示自​​定义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆