试试这个演示: http: //jsfiddle.net/rAdV6/20/
另请参阅下面的两个屏幕截图。
进一步详细说明,此修复将允许在日历顶部显示多个日期选择器,无论是否在顶部显示年份。
jQuery代码:
$('.DateTextBox.NoYear').datepicker({
beforeShow: function (input, inst) {
inst.dpDiv.addClass('NoYearDatePicker');
},
onClose: function(dateText, inst){
inst.dpDiv.removeClass('NoYearDatePicker');
}
});
$('#datepicker').datepicker( { changeYear: false, dateFormat: 'dd/mm',});
$('#datepicker1').datepicker( { changeYear: true, dateFormat: 'dd/mm', });
$('#datepicker2').datepicker( { changeYear: false, dateFormat: 'dd/mm', });
CSS:
.NoYearDatePicker .ui-datepicker-year
{
display:none;
}
HTML:
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all">
date (without year) <input type="text" id="datepicker" class="DateTextBox NoYear">
<br />
date 1: (With year) <input type="text" id="datepicker1" >
<br />
date 2: (Without year) <input type="text" id="datepicker2" class="DateTextBox NoYear">
它在我的 lappy OSX 中的显示方式: