【问题标题】:How to disable days is datepicker materializeCSS如何禁用日期是 datepicker materializeCSS
【发布时间】:2017-07-20 11:12:46
【问题描述】:

我正在使用materializeCSS datepicker,我只想选择年份和月份

我试过这个。还有如何格式化日期。我想将其表示为 2017-07-20

$('.datepicker').pickadate({
  selectMonths: true, // Creates a dropdown to control month
  selectYears: 15,
  selectDays: false,
  today: 'Today',
  clear: 'Clear',
  close: 'Ok',
  closeOnSelect: false // Close upon selecting a date,
});
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.0/css/materialize.min.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.0/js/materialize.min.js"></script>

<div class="input-field">
  <input type="date" class="datepicker" name="date" id="date">
</div>

【问题讨论】:

  • 我得到了格式部分。只想知道如何禁用日期选择

标签: datepicker materialize


【解决方案1】:

试试这个代码

$('.datepicker').pickadate({
  selectMonths: true, // Creates a dropdown to control month
  selectYears: 15,
  disable: [true],//disable days
  today: 'Today',
  clear: 'Clear',
  close: 'Ok',
  closeOnSelect: false // Close upon selecting a date,
});

DEMO

【讨论】:

    猜你喜欢
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-19
    • 2013-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多