gpt4 book ai didi

jQuery 用户界面 : Datepicker set year range dropdown to 100 years

转载 作者:IT王子 更新时间:2023-10-29 03:23:38 27 4
gpt4 key购买 nike

使用日期选择器,年份下拉菜单默认只显示 10 年。用户必须单击最后一年才能添加更多年份。

我们如何将初始范围设置为 100 年,以便用户默认看到一个大列表?

enter image description here

    function InitDatePickers() {
$(".datepicker").datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
maxDate: '@maxDate',
minDate: '@minDate'
});
}

最佳答案

您可以根据此处的文档使用此选项设置年份范围 http://api.jqueryui.com/datepicker/#option-yearRange

yearRange: '1950:2013', // specifying a hard coded year range

或者这样

yearRange: "-100:+0", // last hundred years

来自文档

Default: "c-10:c+10"

The range of years displayed in the year drop-down: either relative to today's year ("-nn:+nn"), relative to the currently selected year ("c-nn:c+nn"), absolute ("nnnn:nnnn"), or combinations of these formats ("nnnn:-nn"). Note that this option only affects what appears in the drop-down, to restrict which dates may be selected use the minDate and/or maxDate options.

关于jQuery 用户界面 : Datepicker set year range dropdown to 100 years,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13865218/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com