【问题标题】:How to disable click on month in calendar如何禁用点击日历中的月份
【发布时间】:2017-12-13 10:49:25
【问题描述】:

正如您在图片中看到的那样,我想在 2017 年 12 月禁用点击(黑框)。我该怎么做?

我的日历 javascript 函数。

$('#datepicker').datepicker({
    changeYear: true,
    multidate: true,
    maxViewMode: 0,
    startDate: today,
})

【问题讨论】:

标签: javascript jquery bootstrap-datepicker


【解决方案1】:

也许你可以使用changeMonth 选项如下:

$('#datepicker').datepicker({
  changeYear: true,
  changeMonth: false,
  multidate: true,
  maxViewMode: 0,
  startDate: new Date(),
});

$('#datepicker2').datepicker({
  changeYear: true,
  changeMonth: true,
  multidate: true,
  maxViewMode: 0,
  startDate: new Date(),
});
input {
  width: 25%;
  margin: 1%;
}
<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>

<input type="text" id="datepicker" placeholder="You can't change my month !" />
<input type="text" id="datepicker2" placeholder="You can change my month !" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-04
    • 2014-09-13
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    相关资源
    最近更新 更多