我想在今天之前禁用日期。(即说今天的日期是04Oct17,我希望在此之前的所有日期都已停用,但仍允许用户前几个月,几年等)。
$(document).ready(function () {
var date_input = $('input[name="date"]'); //our date input has the name "date"
var container = $('.bootstrap-iso form').length > 0 ? $('.bootstrap-iso form').parent() : "body";
var options = {
format: 'mm/dd/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
};
date_input.datepicker(options);
})
答案 0 :(得分:0)
在你的datepicker选项中添加minDate
var dateToday = new Date(); // Today's Date.
var options = {
format: 'mm/dd/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
minDate:dateToday // <--- this will disable all date less then dateToday
};
date_input.datepicker(options);