点击图片出现  时间 ,增加一个点击事件

 <label for="" class="width80">创建日:</label>
<div class="input-group">
<div class="date">
<?= Html::TextInput('search[begin_date]',
isset($searchParams['begin_date']) ? $searchParams['begin_date'] : '',
['id' => 'begin_date', 'class' => 'form-control border0 border-radius0', 'style' => "width: 115px;"])
?>
</div>
<div class="input-group-addon white border0 border-radius0">
<i class="iconfont"></i>
</div>
</div>

引入

<?php $this->registerCssFile('@web/assets/datepicker/css/bootstrap-datepicker3.min.css', ['position' => View::POS_BEGIN]) ?>
<?php $this->registerJsFile('@web/assets/datepicker/js/bootstrap-datepicker.min.js', ['position' => View::POS_BEGIN]) ?>
<?php $this->registerJsFile('@web/assets/datepicker/locales/bootstrap-datepicker.zh-CN.min.js', ['position' => View::POS_BEGIN]) ?>

 $("#begin_date").datepicker({
format: 'yyyy-mm-dd',
language: 'zh-CN',
autoclose: true,
}).on('show', function () {
var $datepick = $(".datepicker");
var bottom = $datepick.position().bottom;
});

增加点击事件

 /* datepicker bind icon show*/
$(function(){
$(".input-group-addon").click(function(){
$(this).prev().find("input").focus();
})
});
04-14 10:53