如何在materilize CSS中控制自动打开的Datepicker?

时间:2015-12-10 06:53:05

标签: javascript jquery html css materialize

Demo link

   <input type="date" class="datepicker">

    $('.datepicker').pickadate({
        selectMonths: true, // Creates a dropdown to control month
        selectYears: 15 // Creates a dropdown of 15 years to control year
   });
  

从日期选择器中选择日期后,当我们移动到窗口上的下一个选项卡时,您再次返回当前窗口时,日期选择器已自动打开。

1 个答案:

答案 0 :(得分:5)

尝试:

  $('.datepicker').pickadate({
    selectMonths: true, // Creates a dropdown to control month
    selectYears: 15, // Creates a dropdown of 15 years to control year
    onClose: function(){
        $('.datepicker').blur();
        $('.picker').blur();
       }
  });

http://jsfiddle.net/7ujbv2yz/