-2
这个函数用于日期选择器来设置属性beforeShowDay
。 这是功能:不理解这个jQuery语法,返回逗号分隔的值
function (date) { return [date.getDay() == startDayIndex, ""] }
这是函数的上下文。
var startDayIndex = getDayIndex($('#rotation_start_time_txt').val());
$("#schedule_start_date").datepicker({
minDate: 0,
beforeShowDay: function (date) { return [date.getDay() == startDayIndex, ""] }
});
函数返回0还是1?添加逗号和空字符串的意义何在?
它返回一个数组,其第二个元素总是空的字符串和第一个布尔值 – Tushar
这不是jQuery,它只是javascript。它返回的数组总是包含一个布尔值作为第一个索引,而一个空字符串作为第二个索引。 –
阅读datepicker文档:http://api.jqueryui.com/datepicker/#option-beforeShowDay –