jQuery Datepicker: Prevent closing picker when clicking a date

后端 未结 9 2216
南方客
南方客 2020-11-29 08:16

Hi fellow stackoverflow:ers,

I\'m using the jQuery Datepicker plugin, together with Martin Milesich Timepicker plugin. Everything works great, except for the fact th

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 09:00

    For reference, and since people have asked me this through mail. Here's a code chunk that needs to be added to timepicker.js:

    /**
     * Don't hide the date picker when clicking a date
     */
    $.datepicker._selectDateOverload = $.datepicker._selectDate;
    $.datepicker._selectDate = function(id, dateStr) {
        var target = $(id);
        var inst = this._getInst(target[0]);
        inst.inline = true;
        $.datepicker._selectDateOverload(id, dateStr);
        inst.inline = false;
        this._updateDatepicker(inst);
    }
    

    Good luck in getting it working on your site!

提交回复
热议问题