物化日期选择器不起作用

时间:2017-08-21 16:29:11

标签: javascript jquery html css html5

我无法在日期选择器中选择年份,并且该选项不完全可见。 这是源链接: http://materializecss.com/forms.html

我在图片下方输出。

https://i.stack.imgur.com/WWJb3.png

我已经编写了由materialise给出的初始化部分。 一旦推荐图片,以便每个人都可以了解我所遇到的错误。

我的代码是:



<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/js/materialize.min.js"></script>
<!--This is the input tag -->
<input type="text" class="datepicker">
&#13;
&#13;
&#13;

3 个答案:

答案 0 :(得分:1)

你需要像这样初始化datepicker:

<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/js/materialize.min.js"></script>
<!--This is the input tag -->
<input type="text" class="datepicker">

<script>
    $('.datepicker').pickadate({
        selectMonths: true, // Creates a dropdown to control month
        selectYears: 15, // Creates a dropdown of 15 years to control year,
        today: 'Today',
        clear: 'Clear',
        close: 'Ok',
        closeOnSelect: false // Close upon selecting a date,
   });
</script>

答案 1 :(得分:1)

尝试添加datepicker初始化JavaScript代码。

$('.datepicker').pickadate({
   selectMonths: true, // Creates a dropdown to control month
   selectYears: 15, // Creates a dropdown of 15 years to control year,
   today: 'Today',
   clear: 'Clear',
   close: 'Ok',
   closeOnSelect: false // Close upon selecting a date,
 });

答案 2 :(得分:0)

&#13;
&#13;
.order_by('user')
&#13;
&#13;
&#13;