先把下面代码贴进去
$(function () {
if ($.validator) {
$.validator.prototype.elements = function () {
var validator = this,
rulesCache = {};
return $([]).add(this.currentForm.elements)
.filter(":input")
.not(":submit, :reset, :image, [disabled]")
.not(this.settings.ignore)
.filter(function () {
var elementIdentification = this.id || this.name;
!elementIdentification && validator.settings.debug && window.console && console.error("%o has no id nor name assigned", this);
if (elementIdentification in rulesCache || !validator.objectLength($(this).rules()))
return false;
rulesCache[elementIdentification] = true;
return true;
});
};
}
});
再贴下面代码
$(function(){
$("#inputForm").validate();
$("input[name='你的name']").each(function(){
$(this).rules("add", {
isFloatZeroAndOneHundred: true,
isIntGteZero:true,
message:{
isFloatZeroAndOneHundred:"请输入0-100之间的数字"
}
});
});
});