Combine jQuery-ui datepicker's localization and initialization parameters

后端 未结 1 1833
时光取名叫无心
时光取名叫无心 2021-01-12 04:45

I want to have my localized datepicker not allow certain dates picking.

Localization:

$(\"#datepicker\").datepicker($.datepicker.regional[\"fr\"]);
<         


        
1条回答
  •  借酒劲吻你
    2021-01-12 05:36

    $.datepicker.regional attribute attribute holds an array of localizations; which themselves are "presets" of the datepicker options. To append your options (overwriting if necessary):

    // use $.extend to merge preset options plus your options
    $("#datepicker1")
        .datepicker($.extend({}, $.datepicker.regional.fr, {
            beforeShowDay: $.datepicker.noWeekends
        }));
    
    // initialize the datepicker, then use .datepicker("option", options) method twice
    $("#datepicker2")
        .datepicker()
        .datepicker("option", $.datepicker.regional.fr)
        .datepicker("option", "beforeShowDay", $.datepicker.noWeekends);
    

    Demo (see example 5)

    0 讨论(0)
提交回复
热议问题