bootstrap jquery minDate 不工作

bootstrap jquery minDate not working

我想在 bootstrap datepicker 中禁用今天之前的所有日期。我在网上查了一下,每个人都有这个解决方案,但为什么它在我的代码中不起作用?

<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();
        });
    });