//使用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。