admin管理员组文章数量:1395248
I have a date picker and i need to set to functions to run on BeforeShowDay.
I can't work out how to run both functions names unavailable and disabledays
/
Thanks in advance
Lee
I have a date picker and i need to set to functions to run on BeforeShowDay.
I can't work out how to run both functions names unavailable and disabledays
http://jsfiddle/rLnTQ/50/
Thanks in advance
Lee
Share Improve this question asked Jun 3, 2011 at 9:43 LeeLee 1,2804 gold badges18 silver badges37 bronze badges1 Answer
Reset to default 7How about bining them into one?
function disabledays(date) {
dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
if ($.inArray(dmy, unavailableDates) == 0) {
return [false, "", "Unavailable"]
} else {
var day = date.getDay();
return [(day != 0 && day != 2)];
}
}
$('#txtDate').datepicker({ beforeShowDay: disabledays })
http://jsfiddle/rLnTQ/104/
Or you can put one within the other:
function unavailable(date) {
dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
if ($.inArray(dmy, unavailableDates) == 0) {
return [false, "", "Unavailable"];
} else {
return disabledays(date);
}
}
function disabledays(date) {
var day = date.getDay();
return [(day != 0 && day != 2)];
}
$('#txtDate').datepicker({
beforeShowDay: unavailable
})
http://jsfiddle/rLnTQ/118/
本文标签: javascriptHow to set 2 functions with BeforeShowDay on jQuery DatepickerStack Overflow
版权声明:本文标题:javascript - How to set 2 functions with BeforeShowDay on jQuery Datepicker? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744086383a2588601.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论