Materializecss datepicker not working

Viewed 14033

I am using materializecss for the first time in my web application and I am struggling with datepicker. It is not working at all.

I imported materialize.css and js file and use the code

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

and added script code

 $(document).ready(function() {
    $('select').material_select();


    window.picker = $('.datepicker').pickadate({

        selectYears: 16, // Creates a dropdown of 15 years to control year
        format: 'yyyy-mm-dd'
    });



});

but nothing worked, it shows a disabled text box.

Also I want to know how to add timepicker in materializecss?

3 Answers
        <div class="row">
          <div class="input-field col s12">
            <input id="idate" type="text"  name="idate" class="datepicker" >
            <label for="idate">Issue Date</label>
          </div>
        </div>


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