DatePicker setDates gives a error

How can I use the setDates in Kartik DatePicker?

I use




$('#extCopyDatepicker').datepicker('setDates', myDate);



for the widget id I use




    <?= DatePicker::widget([

        'id' => 'extCopyDatepicker',

    ...

       'multidate' => true,

    ...



But this gives me a error Uncaught TypeError: $(…).datepicker is not a function.

without the


$('#extCopyDatepicker').datepicker('setDates', myDate); 

it runs fine.