我的代码
<div class="col-md-4">DisablePast Date</div>
<div class="col-md-8">
<input class="form-control datepicker" type='date' id="date">
</div>
脚本
$(function () {
$("#date").datepicker({ minDate: 0 });
});
答案 0 :(得分:2)
试试这个。
var dateToday = new Date();
$(function () {
$("#date").datepicker({ minDate: dateToday })
});
<div class="col-md-8">
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
<input class="form-control datepicker" type='date' name="date" id="date">
</form>
</div>
PHP
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['date'])) {
//do processing
}
}