按照这个
problematic example,我似乎无法使用上下箭头来选择早于2001年或晚于2021年的日期.
- Education Record
- did you complete high school? * --> Yes
- clicking Graduation Date *
- clicking 2013 down arrow
是什么导致了这个?在Windows 7和Firefox中的IE10中根本没有显示滚动箭头,滚动箭头显示但是在2001年之前或2021之后无法滚动.解决方法是选择最小或最大日期并再次单击箭头在年之前或之后展示.
解决方法
试试这个 –
jsFiddle
- $(function () {
- $("#datepicker").datepicker({
- changeMonth: true,changeYear: true,yearRange: "-120:+10",// magic!
- dateFormat: 'mm/yy',onClose: function (dateText,inst) {
- var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
- var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
- $(this).datepicker('setDate',new Date(year,month,1));
- }
- });
- });