Bootstrap Datetimepicker不是自动关闭

时间:2016-12-09 06:41:19

标签: bootstrap-datepicker

Bootstrap datetimepicker在选择日期时没有自动关闭。当我从datetimepicker选择日期时,它应该关闭datetimepicker,但它没有关闭

1 个答案:

答案 0 :(得分:0)



$('input.datum').datepicker({  
  autoclose: true
});

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker3.css" rel="stylesheet"/>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/locales/bootstrap-datepicker.de.min.js"></script>

<form action="#" method="post">
    <label>Date:</label>
    <input class="datum" type="text" name="vondatum" required>
    <input type="submit" value="save">
</form>
&#13;
&#13;
&#13;

您需要为此添加autoclose。

$( "#datepicker" ).datepicker({ 
    autoclose: true     
});