如何使用jquery在php yii2中创建DatePicker

My code is as below

<?php echo $form->field($model_emp_info, 'varDob')->textInput(['id'=>'datepicker'])?> 

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

No need to manually attach it like that.

Yii2 has official extension for jQuery UI which is available here.

Add it through composer and then you can use widgets for jQuery UI components.

Basic example with DatePicker (using with model):

echo DatePicker::widget([
    'model' => $model,
    'attribute' => 'from_date',
    //'language' => 'ru',
    //'dateFormat' => 'yyyy-MM-dd',
]);

You can read more in official docs.