我有一个jquery datepicker,我想不允许以前的日期(以及只有特定的日期)
$(function() {
$( "#datepicker" ).datepicker({beforeShowDay: function(date){
var day = date.getDay();
var today = new Date();
return [
(
day > today -- HOW TO DO THIS LINE
&&
day != <?php echo $dateday[0];?>
&&
day != <?php echo $dateday[1];?>
&&
day != <?php echo $dateday[2];?>
&&
day != <?php echo $dateday[3];?>
&&
day != <?php echo $dateday[4];?>
&&
day != <?php echo $dateday[5];?>
&&
day != <?php echo $dateday[6];?>
),''];
}
});
});
答案 0 :(得分:0)
添加&#39; minDate&#39; dataepicker的选项。
var dateToday = new Date();
var dates = $("#from, #to").datepicker({
minDate: dateToday
});