结合jQuery-ui datepicker的本地化和初始化参数 [英] Combine jQuery-ui datepicker's localization and initialization parameters
本文介绍了结合jQuery-ui datepicker的本地化和初始化参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让本地化的日期选择器不允许某些日期选择.
I want to have my localized datepicker not allow certain dates picking.
本地化:
$("#datepicker").datepicker($.datepicker.regional["fr"]);
没有周末:
$("#datepicker").datepicker({ beforeShowDay: $.datepicker.noWeekends })
我不知道如何将两者结合起来?
I cannot figure out how to combine both?
推荐答案
$.datepicker.regional
属性attribute包含一个本地化数组.它们本身是 datepicker选项的预设".要附加您的选项(必要时覆盖):
$.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);
这篇关于结合jQuery-ui datepicker的本地化和初始化参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文