我想选择28作为每个月的最大日期和当前日期时间作为minDate。所以我在下面做了 我的代码是:
var dateToday = new Date();
$("#date1_live").datepicker({
changeMonth: true,
changeYear: true,
showAnim:'slideDown',
dateFormat:'dd M yy',
minDate: dateToday,
maxDate: '28'
});
请帮助我想知道将28设为maxDate ???
答案 0 :(得分:1)
您可以使用beforeShowDay选项
jQuery(function($) {
var dateToday = new Date();
$("#date1_live").datepicker({
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
dateFormat: 'dd M yy',
minDate: dateToday,
beforeShowDay: function(date) {
return [date.getDate() <= 28]
}
});
});
&#13;
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/redmond/jquery-ui.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>
<input id="date1_live" />
&#13;