jQuery validation 分布验证

来源:互联网 发布:gdp增长率的算法 编辑:程序博客网 时间:2024/05/17 21:47

//使用jQuery validation进行分布注册进行验证的时候在http://stackoverflow.com/找到这篇文章,经过测试OK!分享给大家...

Taking what jAndy suggested, I created this helper function:

//创建subset函数,在$(document).ready(function(){});函数内执行下面的操作

jQuery.validator.prototype.subset = function(container) {
var ok = true;
var self = this;
$(container).find(':input').each(function() {
if (!self.element($(this))) ok = false;
});
return ok;
}

usage:

//调用
if (wizardForm.validate().subset('#first-step')) {
// go to next step
}

 

  wizardForm是form里面有多个div,  first-step是第一个div的ID。

原创粉丝点击