我使用jQuery UI的DatePicker爲我的網站上的消費者選擇出生日期。它目前通過下拉式顯示月份和年份。例如,當我通過maxDate
將年限制爲-18y
時,月份下拉式不顯示選擇1993年的所有月份。它只顯示直到最大月份的月份。在選擇器中顯示日期範圍外的日期範圍?
在可用性測試中,我們發現,我們的人口趨於點擊他們的誕生,那麼一年,然後一天的一個月。
是否有辦法顯示所有月份,即使該月份內的日期不可選?
這裏是用來顯示的DatePicker代碼:
$('.DobWidget').datepicker({
showOn: 'both',
buttonImage: '/media/img/admin/icon_calendar.gif',
buttonImageOnly: true,
dateFormat: js_date_format, // mm/dd/yyyy
constrainInput: false, // Handled server-side for type-in.
changeMonth: true,
changeYear: true,
maxDate: '-18y',
minDate: '-110y',
showButtonPanel: true,
onChangeMonthYear: function(year, month, inst) {
if (inst.currentDay != 0) {
$(this).datepicker("setDate", new Date(year, month - 1, inst.currentDay));
}
}
});
我目前使用的jQueryUI的v.1.8.16和jQuery v.1.6.3
,兩者均由谷歌AJAX API的提供。
我看到1990年沒有問題,難道是1993年? –
你是對的。我有兩個範圍,21和18.我把它們混淆爲例子。 1993年是正確的一年。 –