表单验证问题

发布于 2024-09-05 05:00:42 字数 309 浏览 10 评论 0原文

我正在使用 jQuery 验证插件 进行表单验证。我面临的问题是当我有内联标签时。

例如:

<input type="text" name="myinput" value="Enter your ....">

这是验证失败的示例案例,因为为输入字段设置了“值”。有什么解决方法吗?如何忽略默认/标签值?

I am using jQuery validation plugin for form validation. The problem I am facing is when I have inline labels..

For Example:

<input type="text" name="myinput" value="Enter your ....">

This is the sample case where validation is failing because the 'value' is set for input field. Is there any workaround? How do I ignore default/label values?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枉心 2024-09-12 05:00:42

我认为你应该为此创建/添加一个方法..

jQuery.validator.addMethod("exception", function(value, element) { 
  return this.optional(element) || value == "Enter your ...."; 
}, "message if bad");

然后使用 exception : true...

更多关于 addMethod()

I think you should make/add a method for that..

jQuery.validator.addMethod("exception", function(value, element) { 
  return this.optional(element) || value == "Enter your ...."; 
}, "message if bad");

then use exception : true...

more on addMethod()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文