【问题标题】:Disable weekends - bootstrap datepicker禁用周末 - 引导日期选择器
【发布时间】:2016-11-11 18:20:16
【问题描述】:

我正在尝试使我的引导日期选择器输入中的周末不活动。

我试过这个:

$(function() {
   $('#datepicker').datepicker({
       beforeShowDay: $.datepicker.noWeekends
   });
});

还有这个:

$('#datepicker').datepicker({
    daysOfWeekDisabled: [0,6]
});

很遗憾,没有一个成功。

这是我的 BS 的样子:

<div class="form-group">
        <label class="control-label col-sm-2" for="date" ">Date:</label>
        <div class="col-sm-2">
          <input type="date" class="form-control" id="datepicker">
        </div>
      </div>

任何帮助将不胜感激。

【问题讨论】:

    标签: jquery twitter-bootstrap datepicker


    【解决方案1】:

    我没有尝试在 JS 中提供 daysOfWeekDisabled 选项,但是当我使用数据属性版本时,它确实对我正常工作。你可以试试:

    <input type="date" class="form-control" id="datepicker" data-date-days-of-week-disabled="0,6">
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-03
      • 2013-09-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多