我想在引導程序datepicker
之前禁用今天之前的所有日期。我挖了互聯網,每個人都有這個解決方案,但爲什麼它不能在我的代碼中工作?bootstrap jquery minDate不工作
<input type="text" id="date"/>
$(window).load(function(){
$('#date').datepicker({
minDate:0
});
});
我想在引導程序datepicker
之前禁用今天之前的所有日期。我挖了互聯網,每個人都有這個解決方案,但爲什麼它不能在我的代碼中工作?bootstrap jquery minDate不工作
<input type="text" id="date"/>
$(window).load(function(){
$('#date').datepicker({
minDate:0
});
});
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" rel="Stylesheet"
type="text/css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script language="javascript">
$(document).ready(function() {
$("#txtdate").datepicker({
minDate: 0
});
});
</script>
</head>
<body>
Date :
<input id="txtdate" type="text">
</body>
</html>
試試這個!
/* Apply the right format to the minDate option */
$(document).ready(function() {
$("#txtdate").datepicker({
minDate: new Date('12/12/2016');
});
});
的[的minDate不是在引導日期選擇器工作]可能的複製(http://stackoverflow.com/questions/19219713/mindate-not-working-in-bootstrap-datepicker) – ankit
的minDate 0爲什麼呢?它可能是今天的全日期字符串嗎? –
@ankit我甚至嘗試了可能的重複你的建議startDate。它仍然不工作! –