2012-10-24 69 views
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 
        }      
       }); 
      }); 
+1

的[我如何使用jQuery日期选择器与befereshowday两种不同类型的特别突出可能重复日期?(http://stackoverflow.com/questions/1534172/how-can-i-use-jquery-datepicker-to-highlight-with-befereshowday-two-different-ki) – j08691

回答

1

是的,你需要使用beforeShowDay事件,here is the test

... 
    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']; 
    } 
    ... 
相关问题