$(document).ready(function(){
var min="1.2.2";
$.validator.addMethod('xyz', function(value, element, param) {
alert(min);
min=minAorB();// I want to call a function which will return the minimum among A and B.
alert(min);
return (validateAnmcComp(value,param));
}, "Please enter a value less than or equal to "+min);
})(jQuery);
我希望邮件显示为“请输入小于或等于1.4.5的值”
答案 0 :(得分:0)
这会有帮助吗?
$(document).ready(function($) {
function createMinValidator(min) {
return function(value, element, param) {
// use min as required
return (validateAnmcComp(value, param));
};
}
var min = "1.4.5";
var msg = "Please enter a value less than or equal to " + min;
$.validator.addMethod('xyz', createMinValidator(min), msg);
});