简体   繁体   English

Bootstrap DateTimePicker v4在我的ASP.NET页上不起作用

[英]Bootstrap DateTimePicker v4 not working on my ASP.NET page

So, I'm following this guide, but I am still getting a faliure. 因此,我正在遵循指南,但仍然不满意。 I did execute 我确实执行了

PM> Install-Package Bootstrap.v3.Datetimepicker
PM> Install-Package Bootstrap.v3.Datetimepicker.CSS

And this is the header of the page: 这是页面的标题:

   <script type="text/javascript" src="/scripts/jquery-3.3.1.min.js"></script>
   <script type="text/javascript" src="/scripts/moment.min.js"></script>
   <script type="text/javascript" src="/scripts/bootstrap.min.js"></script>
   <script type="text/javascript" src="/scripts/bootstrap-datetimepicker.js"></script>
    <link rel="stylesheet/less" type="text/css" href="/Content/bootstrap-datetimepicker-build.less" />
    <!-- or -->
    <link rel="stylesheet" href="/Content/bootstrap-datetimepicker.css" />
     <!--End of Datetimepicker-->
    <link href="Content/bootstrap.css" rel="stylesheet" />
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.bootstrap.min.css" rel="stylesheet"/>

Note: I made a little modifications because it was causing a 404 finding the files, for instance I changed jquery.min.js with jquery-3.3.1.min.js and /scripts/bootstrap-datetimepicker.*js" with /scripts/bootstrap-datetimepicker.js" . 注意:我进行了一些修改,因为这导致404查找文件,例如,我使用jquery-3.3.1.min.js更改了jquery.min.js ,并使用/scripts/bootstrap-datetimepicker.js"更改了/scripts/bootstrap-datetimepicker.*js" /scripts/bootstrap-datetimepicker.js"

Then I added this code as follows: 然后我添加了以下代码:

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

But I am getting this error: 但我收到此错误:

在此处输入图片说明 At this line: $('#datetimepicker1').datetimepicker({ 在此行: $('#datetimepicker1').datetimepicker({

I searched a lot and found lots of answers wich are not working to me. 我进行了很多搜索,发现很多答案对我没有用。

Thank you in advance. 先感谢您。

Ok, I fixed it. 好,我把它修好了。 The problem was, on the page was also a bootstrap table wich required this script: 问题是,页面上还有一个引导表,需要此脚本:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

Apparently, It was overriding the previous import. 显然,它覆盖了以前的导入。 Deleting it fixed it. 删除它可以修复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM