jQuery Datepicker BeforeShowDay第二个参数 [英] jQuery Datepicker BeforeShowDay Second Parameter
本文介绍了jQuery Datepicker BeforeShowDay第二个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
jQuery的datepicker允许您使用BeforeShowDay回调来突出显示日期。
jQuery's datepicker allows you to highlight dates using the BeforeShowDay callback.
是否可以将第二个参数传递给该方法?
Is it possible to pass a second parameter to the method?
$(selector).datepicker({beforeShowDay: selectedDay});
function selectedDay(date) {
// Do stuff
return [true, 'class_name'];
}
如您所见,参数 date
被自动传递给selectedDay方法,因此我不知道如何传递第二个参数。
As you can see, the parameter date
is automatically passed to the selectedDay method, thus making me unsure as to how to pass a second parameter.
干杯。
推荐答案
我想知道同一个问题,我想我找到了答案:
I was wondering about the same question and I think I found the answer:
function selectedDay(date, param ) {
// Do stuff with param
return [true, ''];
}
function doStuff(){
var param = "param_to_pass";
$(selector).datepicker({
beforeShowDay: function (date){
return selectedDay(date, param );
}
});
}
这篇关于jQuery Datepicker BeforeShowDay第二个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文