我正在使用https://eonasdan.github.io/bootstrap-datetimepicker/中的Bootstrap的日期时间选择器。当在Bootstrap datetimepicker中单击月份名称时,我想禁用切换到“年”查看模式和“年”组查看模式。我该如何实现?
答案 0 :(得分:2)
如果您想设置完整日期并且仍然能够切换到月视图,则需要像这样设置maxViewMode
:
$('#pick').datepicker({
maxViewMode: 'months'
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.css">
<input type="text" id="pick">