javascript Jquery Validate - 类列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9353628/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 06:22:17  来源:igfitidea点击:

Jquery Validate - List of Classes

javascriptjqueryjquery-validatevalidation

提问by user982853

This may be a very stupid question but i am looking for a list of the inline validation rules for the jquery form validator.

这可能是一个非常愚蠢的问题,但我正在寻找 jquery 表单验证器的内联验证规则列表。

I know that i can find the js functions here:

我知道我可以在这里找到js 函数

but i am looking for a list of the simple inline classes like

但我正在寻找一个简单的内联类列表,例如

email, url, phone, etc., and learn how to use them. I am just looking for a simple list. Thank you.

电子邮件、网址、电话等,并学习如何使用它们。我只是在寻找一个简单的列表。谢谢你。

回答by Andrew Whitaker

Looking at the source, I believe these are the only rules that can be used simply by adding classes:

查看源代码,我相信这些是唯一可以通过添加类来使用的规则:

  • required
  • email
  • url
  • date
  • dateISO
  • number
  • digits
  • creditcard
  • 必需的
  • 电子邮件
  • 网址
  • 日期
  • 日期ISO
  • 数字
  • 数字
  • 信用卡

As for how to use them, just add them into the classattribute of your input:

至于如何使用它们,只需将它们添加到class您的属性中input

<input type='text' class='required creditcard' name='credit-card' />

You'll have to define other rules in the object you pass to validate.

您必须在传递给的对象中定义其他规则validate

回答by Adrian P.

Most probably you are looking for this

很可能你正在寻找这个

http://elegantcode.com/wp-content/uploads/2010/03/Jquery-Validator-Cheat-sheet.pdf

http://elegantcode.com/wp-content/uploads/2010/03/Jquery-Validator-Cheat-sheet.pdf

Founded when I was looking for same easy to remember list of validation plugin rules. :)

当我正在寻找同样容易记住的验证插件规则列表时成立。:)

Update: If you like to have all things together try this too:

更新:如果你喜欢把所有的东西放在一起试试这个:

http://marketblog.envato.com/resources/extensive-collection-cheatsheets-web-designers

http://marketblog.envato.com/resources/extensive-collection-cheatsheets-web-designers