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 ...
随机推荐
- apache开启重写模式
现在的好多的框架都使用有路由机制,但是如果在apache下,没有开启重写模式,服务器不会读取路由 所以今天要分享一下apache开启重写模式 ubuntu下: 1.在命令行下 sudo a2enmod ...
- MySQL数据库(增删查改)
创建一个表:create table user( uid varchar(10) , pwd int(10) ); 学生表: create table student( sno varchar(20) ...
- 深入解析HashMap、HashTable
集合类之番外篇:深入解析HashMap.HashTable Java集合类是个非常重要的知识点,HashMap.HashTable.ConcurrentHashMap等算是集合类中的重点,可谓“重中之 ...
- Java 将word转为pdf jacob方式
package com.doctopdf; import java.io.File; import com.jacob.activeX.ActiveXComponent; import com.jac ...
- .NET Core 的 Span<T> 学习与使用笔记
一.阅读材料 All About Span: Exploring a New .NET Mainstay Span<T> - byte to int conversions Span< ...
- [efficiency] emacs入门
一. 没记错的话,这可能是第三次读emacs tutorial了.前两次读的非常慢,也不记得有没有读完了.总之最后都忘光了. 这次读的很顺畅,利用工作的空闲时间加上今天晚上(周日).总算是读完了. 没 ...
- Java并发问题--乐观锁与悲观锁以及乐观锁的一种实现方式-CAS
首先介绍一些乐观锁与悲观锁: 悲观锁:总是假设最坏的情况,每次去拿数据的时候都认为别人会修改,所以每次在拿数据的时候都会上锁,这样别人想拿这个数据就会阻塞直到它拿到锁.传统的关系型数据库里边就用到了很 ...
- #WEB安全基础 : HTTP协议 | 0x4 各种协议与HTTP协议的关系(一个报文的旅行)
报文是怎么旅行的呢? 在网络中有很多引路人,如HTTP协议,IP协议.TCP协议.DNS协议以及ARP协议. 请看下图,演绎一个报文的旅程 这就是一个报文的完整请求过程,请加以理解并记忆 //本系列教 ...
- windows程序设计 Unicode和多字节
Unicode和多字节 Unicode是宽字符 多字节是窄字符 类型 变量类型 初始化方式 Unicode LPWSTR L"string" 多字节 LPSTR "str ...
- docker中i的作用
#docker container createKeep STDIN open even if not attached #docker container startAttach container ...