[英]jQuery Datepicker on customizing year
I have used datepicker from http://keith-wood.name/datepick.html and it was great. 我使用了http://keith-wood.name/datepick.html中的datepicker ,它很棒。
But I have a problem on controlling the year range. 但是我在控制年份范围方面有问题。
Here's my code. 这是我的代码。
$('#date_executed').datepick({
dateFormat: 'MM dd, yy',
yearRange:'2011:2012',
showOn: 'both',
buttonImageOnly: true,
buttonText: 'Calendar',
buttonImage: "images/calendar.gif"
});
I need to add 2009 to the list of year but I don't want to include 2010. please help me thanks. 我需要将2009添加到年份列表中,但我不想包含2010。请帮助我,谢谢。
You can try this: 您可以尝试以下方法:
var yearRemoved = false;
$(".ui-datepicker").on("mouseenter", function() {
if (!yearRemoved) {
yearRemoved = true;
$("select.datepick-month-year option[value$='2010']").remove();
}
});
将年份范围更改为yearRange:'2009:2012'
然后删除加载的2010,如下所示:
$("select.datepick-month-year option[value$='2010']").remove();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.