bootstrap jquery minDate不工作

时间:2016-07-18 12:35:27

标签: jquery twitter-bootstrap datepicker mindate

我想在今天的引导程序datepicker之前禁用所有日期。我已经挖了互联网,每个人都有这个解决方案,但为什么它不能在我的代码中工作?

<input type="text" id="date"/>
$(window).load(function(){
   $('#date').datepicker({
        minDate:0
   });
});

2 个答案:

答案 0 :(得分:1)

<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>

答案 1 :(得分:0)

试试这个!

    /* Apply the right format to the minDate option */
    $(document).ready(function () {
        $("#txtdate").datepicker({
            minDate: new Date();
        });
    });
相关问题