如何为每个类别(成人儿童卧室)设置不同的最小值和最大值
$.fn.NCS = function(options) {
$input = $(this);
$originalPlaceholder = $input.attr("placeholder");
var settings = $.extend({
// Defaults.
categoryNames: ["Adults", "Children", "Bedrooms"],
categoryValues: false,
minValue: 0,
maxValue: 10,
closeOnOutsideClick: true,
showText: true,
delimiter: ", ",
align: "left",
fade: true,
useDisplay: true,
showZero: false,
callback: function(values) {}
}, options);
答案 0 :(得分:2)
看到代码后,我认为您正在使用NumberCategorySelector Jquery插件(应该指定它而不是php)
解决方案将传递数组
var settings = $.extend({
// Defaults.
categoryNames: ["Adults", "Children"],
categoryValues: false,
minValue: 0,
maxValue: [10,20,30],
closeOnOutsideClick: true,
showText: true,
delimiter: ", ",
align: "left",
fade: true,
useDisplay: true,
showZero: false,
callback: function(values){}
}, options);
然后使用settings.Maxvalue作为数组:
$category = $(this).attr("category");
if (settings.categoryValues[$category] <settings.maxValue[$category]) {
///etc
}