Bootstrap 使用twitter datepicker.css和引导程序datepicker.js

kcwpcxri  于 2022-12-07  发布在  Bootstrap
关注(0)|答案(2)|浏览(195)

我尝试使用twitter datepicker.css和bootstrap-datepicker.js创建一个日期选择器,但是没有成功。我在这个项目中使用的是codeigniter。

<input type="text" name="end_date" value="" class="datepicker" data-format="dd-MM-yyyy" />  

<script>
    $(function() {
        $( ".datepicker" ).datepicker();
    });
</script>

我已经包括了上面提到的两个文件,但这是不工作。我如何才能使它工作?
我有一个错误(Firebug)--〉“类型错误:$(...).datepicker不是函数”

6ie5vjzr

6ie5vjzr1#

You can can use : http://www.eyecon.ro/bootstrap-datepicker/

$(function() {
  $(".datepicker").datepicker({format:'dd/mm/yyyy'});
});

here's a working example : https://refork.codicode.com/x771

r7knjye2

r7knjye22#

red one,
It would be helpful to share a jsFiddle of your code. At least let us know what scripts you are loading and styles you are loading and in which order. Since the datepicker is dependent on jQuery you need to make sure that jQuery is loading before your .js files. You asked about the bootstrap-responsive and bootstrap files. As long as you are linking to the correct one it should work.
Hopefully that gives you a little direction. Will update when you share more information.

相关问题