datetimepicker不自动关闭

时间:2016-05-17 03:16:20

标签: javascript twitter-bootstrap datepicker

以下是观点:



 <div id="datetimepicker2" class="input-append" style="resize: none;" data-autoclose="true">
                        <label class="control-label"><h3 style="color: #821571;font-family: 'Philosopher',sans-serif;">Tanggal dan Waktu</h3></label><br />
                        <input data-format="MM/dd/yyyy HH:mm PP" type="text" class="form-control" id="pickup" name="pickup" style="height:50px; width: auto;" placeholder="Klik icon sebelah kanan"></input>
                        <span class="add-on" style="height: 50px;">
                        <i data-time-icon="icon-time" data-date-icon="icon-calendar" style="height: 50px;"></i>
                        </span>
                    </div>
&#13;
&#13;
&#13;

和js:

&#13;
&#13;
$(function() 
    {
        $('#datetimepicker2').datetimepicker
        ({
            pick12HourFormat: true,
            language: 'en'
        });
    });
&#13;
&#13;
&#13;

当我选择日期并点击输入表单以外的任何地方时,datetimepicker关闭,但是当我选择时间并在外面的任何地方点击时,它不会自动关闭。我该如何解决?

1 个答案:

答案 0 :(得分:-2)

添加选项autoclose: true

$(function() 
    {
        $('#datetimepicker2').datetimepicker
        ({
            autoclose: true
        });
    });