jQuery UI Datepicker - 禁用当前日期,但不显示高亮 [英] jQuery UI Datepicker - Disable current date but NOT the highlight
本文介绍了jQuery UI Datepicker - 禁用当前日期,但不显示高亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码通过将minDate设置为当前日期+ 1来禁用当前日期:
I have the following code which disables the current date by setting minDate to current date + 1:
var today = new Date();
var tomorrow = new Date();
tomorrow.setDate(today.getDate() + 1);
$("#minDate").datepicker({
showOn: "none",
minDate: tomorrow,
dateFormat: "DD dd-mm-yy",
onSelect: function(dateText) {
minDateChange;
},
inputOffsetX: 5,
});
问题是我要禁用当前日期,但仍然保持突出显示(蓝色边框周围的日期)在日历中。
The problem is that I want to disable the current date, but still keep it highlighted (Blue border around the date) in the calendar.
有没有一种本机的方法来使用datepicker或者我必须自己创建一个高亮脚本?
Is there a native way to do this using the datepicker or do I have to create a highlight script myself?
推荐答案
datepicker在今天的日期里有一个名为ui-datepicker-today的课程,所以我只是添加了一个类:
The datepicker has a class on todays date called "ui-datepicker-today", so I simply added a class to that:
$(".ui-datepicker-today span").addClass("ui-state-hover")
这篇关于jQuery UI Datepicker - 禁用当前日期,但不显示高亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文