我正在使用datepicker在两个日期字段中选择日期(从日期到日期).
在那些中,默认突出显示的日期是今天的日期.我需要在第二个datepicker中将默认突出显示的日期更改为其他日期.(例如今天+ 8天).
我该怎么做才能正确?
以下是我的日期选择器,
$(function() {
$( "#datepicker" ).datepicker();
$( "#datepicker" ).datepicker("option", "dateFormat", "yy-mm-dd"); // ISO 8601
$( "#datepicker2" ).datepicker();
$( "#datepicker2" ).datepicker("option", "dateFormat", "yy-mm-dd");
});
Run Code Online (Sandbox Code Playgroud)
谢谢.
----------------------------------更新--------------- --------------------------------
继迈克尔的屏幕截图后,

我把以下,
$( "#datepicker2" ).datepicker("option", "defaultDate", +2);
Run Code Online (Sandbox Code Playgroud)
你可以看到21天(今天)是突出显示,23是黑线边界.我需要看到23看起来像21喜欢照明.无需强调21.
$( "#datepicker" ).datepicker("option", "defaultDate", +8);
Run Code Online (Sandbox Code Playgroud)
资料来源:http://api.jqueryui.com/datepicker/#option-defaultDate
编辑:当前日期将始终作为日期选择器的一部分突出显示.没有选项可以关闭此功能.它是向用户说明"今天"是什么.但是,您可以使用某些CSS覆盖此图形外观:
.ui-datepicker-today a.ui-state-highlight {
border-color: #d3d3d3;
background: #e6e6e6 url(/themeroller/images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;;
color: #555555;
}
.ui-datepicker-today.ui-datepicker-current-day a.ui-state-highlight {
border-color: #aaaaaa;
background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;
color: #212121;
}
Run Code Online (Sandbox Code Playgroud)
工作jsfiddle:http://jsfiddle.net/EpWud/
这假设您使用的是默认主题 - 但您可以对任何主题执行相同的练习.只需覆盖上面代码的样式.但是,这个CSS不完整.您需要为其他情况进行覆盖,例如:悬停状态.