【发布时间】:2015-10-05 09:09:44
【问题描述】:
请看我的fiddle
我所追求的是如果年份与当前年份匹配,则禁用“上一个”按钮,但我还想将“下一个”按钮限制为仅在下一年启用,如果他们单击它,然后它会被禁用。
我尝试过使用minDate: "0" 和maxDate: "1y",但它们不起作用。
HTML
<div class="input-group date" style="width: 200px">
<input type="text" id="example1" class="form-control" style="cursor: pointer"/>
<span class="input-group-addon">
<i class="glyphicon glyphicon-calendar"></i>
</span>
</div>
JQuery
$('#example1').datepicker
({
format: "MM yyyy",
minViewMode: 1,
changeYear: true,
autoclose: true
});
CSS
.datepicker-switch
{
pointer-events: none;
}
我不想在我的代码中添加年份,否则我将不得不每年更新它并发布我的网站,那么如何在不添加的情况下做到这一点。
【问题讨论】:
标签: javascript jquery jquery-ui-datepicker bootstrap-datepicker