admin管理员组文章数量:1394593
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.
Is there a native way to do this using the datepicker or do I have to create a highlight script myself?
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.
Is there a native way to do this using the datepicker or do I have to create a highlight script myself?
Share Improve this question edited Mar 6, 2014 at 8:24 Dumpen asked Apr 17, 2013 at 11:48 DumpenDumpen 1,6726 gold badges22 silver badges36 bronze badges 2- Isn't the highlighted date the default chosen? If so, it can't be chosen and out of defined range at the same time. – Jakub Matczak Commented Apr 17, 2013 at 11:59
- 1 First, just disable current date by, minDate: "+1D", and then override its style as: .ui-datepicker-today span{background: #036!important; something else....} to anything you need. – HENG Vongkol Commented Aug 28, 2016 at 12:33
2 Answers
Reset to default 1you don't need to set today and tomorrow as a variable. just set minDate: 1
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")
本文标签: javascriptjQuery UI DatepickerDisable current date but NOT the highlightStack Overflow
版权声明:本文标题:javascript - jQuery UI Datepicker - Disable current date but NOT the highlight - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744096202a2590327.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论