引导程序中的DateTime选择器不起作用

时间:2015-02-15 17:56:03

标签: twitter-bootstrap

我正在尝试在bootstrap中实现日期时间选择器。

我查看了网站thisthis 作为参考,因为datetimepicker不起作用。

即使是现在,它也不起作用。

以下是代码:

<div class="form-group" id="rgrp3">
    <div class='input-group date' id='datetimepicker1'>
        <input type='text' data-format="dd/MM/yyyy" class="form-control" />
        <span class="input-group-addon">
              <span class="glyphicon glyphicon-calendar"></span>
              </span>
        </div>
</div>

JS:

$('#datetimepicker1').datetimepicker({
    language: 'pt-BR'
});

修改

整个模态对话框的代码:

<!-- Registration Modal -->
<div class="modal fade" id="modRegister" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-open modal-vertical-centered" id="wndRegBox">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="color: white">x</button>
                <h4 class="modal-title" id="myModalLabel" style="color: white">Please Sign Up</h4>
            </div>
            <div class="modal-body">
                <div class="container">

                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-6">
                            <form role="form">
                                <h2></h2>
                                <hr class="colorgraph">
                                <div class="row">
                                    <div class="col-xs-12 col-sm-6 col-md-6">
                                        <div class="form-group" id="rgrp1">
                                            <input type="text" name="first_name" id="rfirst_name" class="form-control input-lg" placeholder="First Name" tabindex="1">
                                        </div>
                                    </div>
                                    <div class="col-xs-12 col-sm-6 col-md-6">
                                        <div class="form-group" id="rgrp2">
                                            <input type="text" name="last_name" id="rlast_name" class="form-control input-lg" placeholder="Last Name" tabindex="2">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" id="rgrp3">
                                    <div class='input-group date' id='datetimepicker1'>
                                        <input type='text' data-format="dd/MM/yyyy" class="form-control" />
                                        <span class="input-group-addon">
                                            <span class="glyphicon glyphicon-calendar"></span>
                                        </span>
                                    </div>
                                </div>
                                <div class="form-group" id="rgrp4">
                                    <input type="email" name="email" id="remail" class="form-control input-lg" placeholder="Email Address" tabindex="4">
                                </div>
                                <div class="row">
                                    <div class="col-xs-12 col-sm-6 col-md-6">
                                        <div class="form-group" id="rgrp5">
                                            <input type="password" name="password" id="rpassword" class="form-control input-lg" placeholder="Password" tabindex="5">
                                        </div>
                                    </div>
                                    <div class="col-xs-12 col-sm-6 col-md-6">
                                        <div class="form-group" id="rgrp6">
                                            <input type="password" name="password_confirmation" id="rpassword_confirmation" class="form-control input-lg" placeholder="Confirm Password" tabindex="6">
                                        </div>
                                    </div>
                                </div>
                                <hr class="colorgraph">
                            </form>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" id="btnRegister" class="btn btn-primary gradient">Register</button>
                    <button type="button" class="btn btn-primary gradient" data-dismiss="modal">Cancel</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>

1 个答案:

答案 0 :(得分:0)

您记得添加moment.js吗?

DEMO http://jsfiddle.net/maxlipsky/cyk4f8wm/2/