jquery validate 验证自定义样式
????? 最近在找一些表单验证框架, 也看了很多 。 由于以前使用过jquery validate 进行一些简单的例子,于是从内心上开始的时候就偏向了他,不过这次想系统的了解用下还是有点波折的。在使用中的时候我发现 jquery validate 的作者的表单验证的思路和我平时的还真的不一样。
?
???? 下面就记录一些使用中的问题吧。具体使用方法也不多介绍
?
???? 1.? :text? 框不输入就离开不验证的问题
?
? 4? 高亮显示
?
?? 高亮显示主要是通过
?
? highlight 和 unhighlight 来进行完成的, 针对于验证对象的一些css 操作 , 但是在 resetForm 中,根本没有对高亮显示的对象进行reset, 做了点修改
?
?
resetForm: function() {if ($.fn.resetForm)$( this.currentForm ).resetForm();this.submitted = {};this.prepareForm();this.hideErrors();this.elements().removeClass( this.settings.errorClass );for(var i=0; i< this.elements().length; i++){this.settings.unhighlight.call( this, this.elements()[i], this.settings.errorClass, this.settings.validClass );}},?? 我源码也没全看 也只是片段性的看了下,如有错误还请指出
?
?
?
?
1 楼 a_alter 2011-08-15 hideErrors: 修改
if(this.settings.success){
if(typeof this.settings.success == "string"){
this.addWrapper(this.toHide).hide();
}else{
this.settings.success(this.toHide);
}
}else{
this.addWrapper(this.toHide).hide();
}
不然会影响以前的功能