javascript - Disabling current day highlighting on Twitter Bootstrap Datepicker - Stack Overflow

I'm using a datepicker for Twitter Bootstrap. I need to disable the current day from being selecte

I'm using a datepicker for Twitter Bootstrap. I need to disable the current day from being selected, which means it also should not highlight the current date.

I've passed in the parameter "todayHighlight" as false, but it's still giving the TD the "active" class even though it also has "disabled".

$("#datepicker").datepicker({
    format: 'mm-dd-yyyy',
    daysOfWeekDisabled: [0,6],
    startDate: '02-04-2013',
    endDate: '02-16-2013',
    todayHighlight: false
});

It appears to be a bug in the script. Can anyone help me out and tell me how to fix it?

Here's my fiddle that shows a working example.

I'm using a datepicker for Twitter Bootstrap. I need to disable the current day from being selected, which means it also should not highlight the current date.

I've passed in the parameter "todayHighlight" as false, but it's still giving the TD the "active" class even though it also has "disabled".

$("#datepicker").datepicker({
    format: 'mm-dd-yyyy',
    daysOfWeekDisabled: [0,6],
    startDate: '02-04-2013',
    endDate: '02-16-2013',
    todayHighlight: false
});

It appears to be a bug in the script. Can anyone help me out and tell me how to fix it?

Here's my fiddle that shows a working example.

Share Improve this question asked Feb 1, 2013 at 18:03 CofeyCofey 11.4k16 gold badges54 silver badges75 bronze badges 1
  • todayHighlight is false by default – Tomas Ramirez Sarduy Commented Feb 2, 2013 at 3:49
Add a ment  | 

2 Answers 2

Reset to default 6

Just add this to your css file to reset the .active default style, is not a good idea change the bootstrap css directly:

.datepicker table tr td.active:hover, 
.datepicker table tr td.active:hover:hover, 
.datepicker table tr td.active.disabled:hover, 
.datepicker table tr td.active.disabled:hover:hover, 
.datepicker table tr td.active:active, 
.datepicker table tr td.active:hover:active, 
.datepicker table tr td.active.disabled:active, 
.datepicker table tr td.active.disabled:hover:active, 
.datepicker table tr td.active.active, 
.datepicker table tr td.active:hover.active, 
.datepicker table tr td.active.disabled.active, 
.datepicker table tr td.active.disabled:hover.active, 
.datepicker table tr td.active.disabled, 
.datepicker table tr td.active:hover.disabled, 
.datepicker table tr td.active.disabled.disabled, 
.datepicker table tr td.active.disabled:hover.disabled, 
.datepicker table tr td.active[disabled], 
.datepicker table tr td.active:hover[disabled], 
.datepicker table tr td.active.disabled[disabled], 
.datepicker table tr td.active.disabled:hover[disabled]{
        background-image: none;
        background-color: white;
        font-weight: normal;
        color: black;
        text-shadow: none;
    }

Just add setDate to null, That's how I have solved my issue

$("#datepicker").datepicker({
    format: 'mm-dd-yyyy',
    daysOfWeekDisabled: [0,6],
    startDate: '02-04-2013',
    endDate: '02-16-2013',
    todayHighlight: false
}).datepicker("setDate",null);

Hope it helps

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744803843a4594652.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信