jQuery Datepicker “After Update” Event or equivalent

if you need a “afterShow”-event before jquery-ui version 1.9 you can overwrite the datepicker._updateDatepicker function.

for example:

$(function() {
    $.datepicker._updateDatepicker_original = $.datepicker._updateDatepicker;
    $.datepicker._updateDatepicker = function(inst) {
        $.datepicker._updateDatepicker_original(inst);
        var afterShow = this._get(inst, 'afterShow');
        if (afterShow)
            afterShow.apply((inst.input ? inst.input[0] : null));  // trigger custom callback
    }
});

Now the datepicker raise an “afterShow” event after every update from the datepicker element.

I know it isn’t the best way to solve this problem, but it’s better than change the original jquery-ui code.

Leave a Comment