0

如何在日期选择器中突出显示BOLD特定日期?我有日期数组,var datesArray = new Array();我知道我需要使用beforeShowDay:方法,但我无法弄清楚它是否可以工作。

这是我的功能:

            $(function() {
                $( "#datepicker" ).datepicker({ 
                    dateFormat: 'yy-mm-dd', 
                    onSelect: function(dateText, inst) {                             
                        dateSelected(dateText, tid) // run my function on click
                    }                     
                });
            });
4

1 回答 1

1

是的,您需要使用 beforeShowDay 事件,这是测试

   ...
   beforeShowDay: function(d_date){
        console.log(d_date);
        //Here compare your Date Array and the d_date
        var d_picker = new Date(d_date);
        var s_class_highligth = '';
        if($.inArray(d_picker.getDate(),a_date_array)>-1){
            s_class_highligth = 'my_cell_highligth';
        }

        return [true, s_class_highligth, 'this is optional tooltip'];
    }
    ...
于 2012-10-24T16:12:29.380 回答