dateTimePicker的。不显示任何计时器

时间:2017-05-26 10:36:32

标签: javascript jquery html datetimepicker

我遇到了datetimepicker的情况。单击第一个图标时,它不显示任何计时器。第二部作品。 Chrome浏览器未在开发控制台中显示任何错误。有什么建议 ?

<div class="input-append form-group datetimepicker">
    <div class="input-group date">
        <input type='text' data-format="hh:mm:ss" class="form-control" name="evstime" placeholder="Adauga ora" />
        <span class="input-group-addon">
            <span class="glyphicon glyphicon-time"></span>
        </span>
    </div>
</div>

<div class="input-append form-group datetimepicker">
    <div class="input-group date">
        <input type="text" data-format="hh:mm:ss" class="form-control" name="evstime" placeholder="Adauga ora"/>
        <span class="add-on">
            <i class="fa fa-clock-o" aria-hidden="true"></i>
        </span>
    </div>
</div>  

jQuery的:

$(function() {
    $('.datetimepicker').datetimepicker({
        pickDate: false 
    });
});  

    <script src='js/moment.min.js'></script>
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="js/bootstrap-datetimepicker.min.js"></script>
    <script src='js/fullcalendar.min.js'></script>
    <script src='js/calendar.js'></script>
    <script src="js/bootstrap.min.js"></script>
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/bootstrap-datetimepicker.min.css">

2 个答案:

答案 0 :(得分:0)

您可以将这些添加为CDN。

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" /> 
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script>

仅使用datepicker:

<script>
    $(function() {
        $('.form-control').datepicker({
            pickDate: false 
        });
    });  
</script>

通常,检查库依赖项。以下是有关它的更多信息:https://jqueryui.com/datepicker/

答案 1 :(得分:0)

问题是您尝试初始化 return Disposables.create { [weak object] in subscription.dispose() - unregisterDelegate.dispose() object?.layoutIfNeeded() + unregisterDelegate.dispose() } 上的datetimepicker而不是<div>本身。尝试将<input>更改为:

HTML

请注意每个<div class="input-append form-group"> <div class="input-group date"> <input type='text' data-format="hh:mm:ss" class="form-control datetimepicker" name="evstime" placeholder="Adauga ora" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-time"></span> </span> </div> </div> <div class="input-append form-group datetimepicker"> <div class="input-group date"> <input type="text" data-format="hh:mm:ss" class="form-control datetimepicker" name="evstime" placeholder="Adauga ora"/> <span class="add-on"> <i class="fa fa-clock-o" aria-hidden="true"></i> </span> </div> </div> 的{​​{1}}属性中包含的datetimepicker ..

要一次初始化所有class控件,请使用:

input

修改

datetimepickerdisable your datetimepickerremove this attribute,一切都应按预期工作。