gpt4 book ai didi

php - 如何在 jquery 日历中添加更多过去的年份

转载 作者:行者123 更新时间:2023-11-27 22:42:00 25 4
gpt4 key购买 nike

我正在使用修改后的(遵循从 stackoverflow 中获取的修改后的代码)jquery 日历,但我想添加更多过去的年份并且无法选择日期.. 在这个日历中请帮助我如何做到这一点?html 文件中使用的修改后的脚本这是:-

<script>
$(document).ready(function() {
$(".datepicker").datepicker( {
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'dd 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));
},
beforeShow : function(input, inst) {
if ((datestr = $(this).val()).length > 0) {
year = datestr.substring(datestr.length-4, datestr.length);
month = jQuery.inArray(datestr.substring(0, datestr.length-5), $(this).datepicker('option', 'monthNames'));
$(this).datepicker('option', 'defaultDate', new Date(year, month, 1));
$(this).datepicker('setDate', new Date(year, month, 1));
}
}
});
});
</script>

最佳答案

试试这个:

 $(".datepicker").datepicker({ 
yearRange: '1700:2050',

年份范围给你更多的年份

关于php - 如何在 jquery 日历中添加更多过去的年份,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10328764/

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