简体   繁体   中英

jQuery UI Datepicker - Disable current date but NOT the highlight

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,
        });

禁用当前日期的Datepicker

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?

datepicker在今天的日期有一个名为“ui-datepicker-today”的类,所以我只是添加了一个类:

$(".ui-datepicker-today span").addClass("ui-state-hover")

you don't need to set today and tomorrow as a variable. just set minDate: 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM