Bootstrap Datetimepicker没有显示为空

时间:2015-10-10 17:58:15

标签: javascript css twitter-bootstrap twitter-bootstrap-3 datetimepicker

Datetimepicker运行不正常没有日期时间显示。没有显示为空。应该是什么问题?

包括CSS和JS脚本

<link rel="stylesheet" href="includes/css/bootstrap.min.css">
<link rel="stylesheet" href="includes/css/user.css">
<link rel="stylesheet" href="includes/css/bootstrap-datetimepicker.min.css">

<script src="includes/js/jquery-1.11.3.min.js"></script>
<script src="includes/js/bootstrap.min.js"></script>
<script src="includes/js/bootstrap-datetimepicker.min.js"></script>

的DateTimePicker

<div class='input-group date' id='datetimepicker1'>
    <input type='text' class="form-control" />
    <span class="input-group-addon">
        <span class="glyphicon glyphicon-calendar"></span>
    </span>
</div>
<script type="text/javascript">
    $(function () {
        $('#datetimepicker1').datetimepicker();
    });
</script>

2 个答案:

答案 0 :(得分:0)

我可以看到你在Div而不是输入上使用dateTimePicker:

<div class='input-group date' id='datetimepicker1'> //here

而不是这给你的输入id,然后应用于此,如:

<input type='text' class="form-control" id="dateInput" />
$('#dateInput').datetimepicker();//this should be in js

This Demo

这样的东西

答案 1 :(得分:0)

遇到相同的问题,并意识到bootstrap-datetimepicker依赖bootstrap-glyphicons来显示默认UI。

因为我使用的是超棒的字体,所以将对.datetimepicker的呼叫更改为:

$("#datepicker").datetimepicker({
    icons: {
        today: "fas fa-bomb",
        date: "fas fa-calendar",
        time: "fas fa-clock-o",
        up: "fa fa-arrow-up",
        next: "fa fa-arrow-right",
        down: "fa fa-arrow-down",
        previous: "fa fa-arrow-left",
        clear: "fas fa-circle-o",
        close: "fas fa-times"
    },
});

文档:https://eonasdan.github.io/bootstrap-datetimepicker/Options/#icons