jQuery validator plugin之Validator
Validator.destroy()
Destroys this instance of validator freeing up resources and unregistering events.
jQuery.validator.methods
Object holding all validation methods known to the validator. This can be accessed to override individual methods, while keeping the default messages.
jQuery.validator.addClassRules()
jQuery.validator.addClassRules( name, rules )
jQuery.validator.addClassRules( rules )
- rulesType: ObjectA map of className-rules pairs (see example).
jQuery.validator.setDefaults()
jQuery.validator.setDefaults( options )
- optionsType: ObjectOptions to set as default.
Accepts everything that validate() accepts.
jQuery.validator.format()
One or more arguments can be passed, in addition to the string template itself, to insert into the string.
If you're familiar with the term, this makes this function support currying. If you don't care about that, just use the first argument.
jQuery.validator.addMethod()
Add a custom validation method. It must consist of a name (must be a legal javascript identifier), a javascript based function and a default string message.
jQuery.validator.addMethod( name, method [, message ] )
- nameType: StringThe name of the method used to identify it and referencing it; this must be a valid JavaScript identifier
- methodType: Function()The actual method implementation, returning true if an element is valid. First argument: Current value. Second argument: Validated element. Third argument: Parameters.
- valueType: Stringthe current value of the validated element
- elementType: Elementthe element to be validated
- paramsType: Objectparameters specified for the method, e.g. for min: 5, the parameter is 5, for range: [1, 5] it's [1, 5]
- messageType: StringThe default message to display for this method. Can be a function created by ''jQuery.validator.format(value)''. When undefined, an existing message is used (handy for localization), otherwise the field-specific messages have to be defined.
For simple one-off validation, you can use the bundled pattern method (in additional methods, source in src/additional/pattern.js) to validate a field against a regular expression.
In general, it is a good idea to encapsulate those regular expressions inside their own method.
If you need lots of slightly different expressions, try to extract a common parameter.
See also a library of regular expressions.
Validator.showErrors()
Show the specified messages.
Validator.showErrors( errors )
- errorsType: ObjectOne or more key/value pairs of input names and messages.
Validator.resetForm()
Resets the controlled form.
Validator.numberOfInvalids()
Validator.numberOfInvalids( errors )
- errorsType: ObjectOne or more key/value pairs of input names and messages.
Returns the number of invalid fields.
Validator.form()
Validates the form, returns true if it is valid, false otherwise.
jQuery validator plugin之Validator的更多相关文章
- jQuery validator plugin之概要
jQuery validator 主页 github地址 demo学习 效果: Validate forms like you've never validated before! 自定义Valida ...
- jQuery validator plugin 之 custom methods 案例1:multi email
1.add method jQuery.validator.addMethod( "multiemail", function (value, element) { var ema ...
- jQuery Validation Plugin学习
http://blog.csdn.net/violet_day/article/details/14109261 jQuery Validation Plugin Demo 一.默认校验规则 (1)r ...
- (转)jQuery Validation Plugin客户端表单证验插件
jQuery Validation Plugin客户端表单验证插件 官方文档:http://jqueryvalidation.org/documentation/ 官方demo:http://jque ...
- 30个非常流行的提示信息插件(jQuery Tooltip Plugin)
在网站的设计中,提示信息是非常细微的功能,但是起着非常重要的作用.如果你的网站中提示信息做的比较好,会给浏览者留下非常深刻的印象,同时也会起到非常好的网站宣传效果,下面介绍了30个比较流行提示信息插件 ...
- JQuery多媒体插件jQuery Media Plugin使用详解
malsup jquery media plugin 该插件可以播放多种类型的多媒体文件包括:Flash, Quicktime, Windows Media Player, Real Player, ...
- jQuery DataTables Plugin Meets C#
Over the weekend, I was doing some work on the internal CMS we use over at eagleenvision.net and I w ...
- 表单验证的validate.js插件---jQuery Validation Plugin
早上在公交车上看了一个关于慕课网的教程<表单验证的validate.js插件---jQuery Validation Plugin>,正好可以用到自己近期开发简易微博的注册页面和登录页面, ...
- jQuery webcam plugin
jQuery webcam plugin The jQuery webcam plugin is a transparent layer to communicate with a camera di ...
随机推荐
- 寻求js
寻找登录的post地址 在form表单中寻找action对应的url地址 post的数据是input标签中的name值作为键,真正的用户名密码作为值得字典,post的url地址就是action对应的u ...
- CSS div 高度满屏
方法一: 通过JQuery,获取窗体的高度,设置给对应的div.代码如下 ht = $(document.body).height(); $(); 缺点:由于浏览器是先解析css,后执行JS,导致页面 ...
- [No000018D]Vim快速注释/取消注释多行的几种方法-Vim使用技巧(2)
在使用Vim进行编程时,经常遇到需要快速注释或取消注释多行代码的场景,Vim教程网根据已有的教程介绍,总结了三种快速注释/取消注释多行代码的方法. 一.使用Vim可视化模式快速注释/取消注释多行 在V ...
- 推举算法 AdaBoost 哥德尔奖 Godel Prize
推举算法 AdaBoost 2003年理论计算机科学界最高奖 哥德尔奖 Godel Prize
- ionic1滑动时间选择器
上图: 1.derective代码 .directive('monthPicker', function ($ionicScrollDelegate) { return { restrict: 'E' ...
- jmeter将JDBC Request查询出的数据作为下一个接口的参数
现在有一个需求,从数据库tieba_info表查出rank小于某个值的username和count(*),然后把所有查出来的username和count(*)作为参数值,用于下一个接口. tieba_ ...
- PHP日常模拟业务的小工具
随机生成姓名 public function getChar($num=2) // $num为生成汉字的数量 { $first = array('赵','钱','孙','李','周','吴','郑', ...
- vue中富文本编辑框
.npm install vue-quill-editor --save .npm install quill --save .封装成子组件 <template> <quill-ed ...
- 常用Git命令清单。
上期传送门:[清单]7个管理和优化网站资源的工具 下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository: ...
- SystemParametersInfo调置壁纸、屏幕保护程序
应用SystemParametersInfo函数可以获取和设置数量众多的windows系统参数.这个小程序就是运用了SystemParametersInfo函数来设置桌面的墙纸,而且程序可以让我们选择 ...