开发者

how to extend the Datepicker's year

http://jqueryui.com/demos/datepicker/#dropdown-month-year

the default dropdown year is form 2000 to 2020, how to extend it. tha开发者_开发知识库nk you. now, i want to set it to 2000 to 2060. how should i do.


You can use yearRange or minDate/maxDate to set the range for the jQueryUI Datepicker. Look in the docs under the Options tab.

http://jqueryui.com/demos/datepicker/#dropdown-month-year


Year range of the drop-down defaults to c-10:c+10 - a 20yr range. If you use min/maxDate your years will be substituted but the -10 & +10 from your default date will remain, forcing users to continually click the end of the range to get a new range set.

The solution is to use yearRange instead of min/maxDate. For instance, yearRange: "c-80:c+5" will give a range of 80 yrs prior to your default date and 5 yrs after that date, all in one continuous range of years in the drop-down. So, if the default date is -20Y, you can get ages from 100yrs old to 15 yrs old. I hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜