且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery验证验证表单数组

更新时间:2023-07-18 14:05:34

请按照以下步骤操作.

Follow the below steps.

1)打开jquery.validate.js文件
2)查找checkForm:function(){
3)用下面的代码替换此功能.

1) Open jquery.validate.js file
2) Find checkForm: function() {
3) Replace this function with below code.

checkForm: function() {
    this.prepareForm();
    for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
        if (this.findByName( elements[i].name ).length != undefined && this.findByName( elements[i].name ).length > 1) {
            for (var cnt = 0; cnt < this.findByName( elements[i].name ).length; cnt++) {
                    this.check( this.findByName( elements[i].name )[cnt] );
            }
        } else {
            this.check( elements[i] );
        }
    }
    return this.valid();
}