Suh*_*pta 2 jquery calendar jquery-ui jquery-ui-datepicker
有没有办法禁用日历中的所有日期?当前的日历构造为:
$('.date-picker-field').datepicker( {
showOtherMonths: true,
selectOtherMonths: true,
changeMonth: true,
changeYear: true,
});
Run Code Online (Sandbox Code Playgroud)
这将显示一个启用了所有日期的日历。我想显示所有日期都被禁用。
您可以使用beforeShowDaymethod并返回带有false值的数组:
$("#datepicker").datepicker({
beforeShowDay:function(date){
return [false, ''];
}
});Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<input type="text" id="datepicker">Run Code Online (Sandbox Code Playgroud)