jQuery.validate.js API
(HappyCZX 整理)
名称 返回类型 描述
validate(options) 返回:Validator 验证所选的 FORM
valid() 返回:Boolean 检查是否验证通过
rules() 返回:Options 返回元素的验证规则
rules("add",rules) 返回:Options 增加验证规则
rules("remove",rules) 返回:Options 删除验证规则
removeAttrs(attributes) 返回:Options 删除特殊属性并且返回他们
Custom selectors
:blank 返回:Validator 没有值的筛选器
:filled 返回:Array <Element > 有值的筛选器
:unchecked 返回:Array <Element > 没选择的元素的筛选器
Utilities
jQuery.format
(template,argument ,argumentN...)
返回:String 用参数代替模板中的 {n}
Validator:
validate 方法返回一个 Validator 对象,它有很多方法, 让你能使用引发校验程序或者改变 form 的内容.
validator 对象有很多方法,但下面只是列出常用的
form() 返回:Boolean 验证 form 返回成功还是失败
element(element) 返回:Boolean 验证单个元素是成功还是失败
resetForm() 返回:undefined 把前面验证的 FORM 恢复到验证前原来的状
态
showErrors(errors) 返回:undefined 显示特定的错误信息
Validator functions:
setDefaults(defaults) 返回:undefined 改变默认的设置
addMethod(name,method,message) 返回:undefined 添加一个新的验证方法. 必须包括一个独一
无二的名字,一个 JAVASCRIPT 的方法和一个
默认的信息
addClassRules(name,rules) 返回:undefined 增加组合验证类型 在一个类里面用多种验
证方法里比较有用
addClassRules(rules) 返回:undefined 增加组合验证类型 在一个类里面用多种验
证方法里比较有用,这个是一下子加多个
内置验证方式:
Downloads By http://www.veryhuo.com