3

当我单击时间图标时,它什么也没显示。我正在使用这段代码:

<div class="control-group">
    <label class="control-label">Next Time</label>
    <div class="controls">
        <div class="input-append bootstrap-timepicker">
            <input id="timepicker1" type="text" class="input-small">
            <span class="add-on"><i class="icon-time"></i></span>
        </div>
    </div>
</div>

这是脚本和 CSS im 使用:

<link type="text/css" href="assets/css/bootstrap-timepicker.min.css" />

<script type="text/javascript" src="assets/js/bootstrap-timepicker.min.js"></script>
<script type="text/javascript">
    $('#timepicker1').timepicker();
</script>
4

3 回答 3

1

您必须将 id 放在您的父 div 上:

<div class="control-group">
    <label class="control-label">Next Time</label>
    <div class="controls">
        <div id="timepicker1" class="input-append bootstrap-timepicker">
            <input type="text" class="input-small">
            <span class="add-on"><i class="icon-time"></i></span>
        </div>
    </div>
</div>
于 2013-06-06T09:42:54.313 回答
0
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link type="text/css" href="css/bootstrap.min.css" />
        <link type="text/css" href="css/bootstrap-timepicker.min.css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap-2.2.2.min.js"></script>
        <script type="text/javascript" src="js/bootstrap-timepicker.min.js"></script>
    </head>
    <body>
        <div class="input-append bootstrap-timepicker">
            <input id="timepicker1" type="text" class="input-small">
            <span class="add-on"><i class="icon-time"></i></span>
        </div>

        <script type="text/javascript">
            $('#timepicker1').timepicker();
        </script>
    </body>
</html>
于 2013-06-06T10:06:48.750 回答
0

它工作正常。你是否也包含了 jquery 和 bootstrap 脚本以及 css?

于 2013-06-06T10:14:04.180 回答