点击图片出现 时间 ,增加一个点击事件
1 <label for="" class="width80">创建日:</label> 2 <div class="input-group"> 3 <div class="date"> 4 <?= Html::TextInput(‘search[begin_date]‘, 5 isset($searchParams[‘begin_date‘]) ? $searchParams[‘begin_date‘] : ‘‘, 6 [‘id‘ => ‘begin_date‘, ‘class‘ => ‘form-control border0 border-radius0‘, ‘style‘ => "width: 115px;"]) 7 ?> 8 </div> 9 <div class="input-group-addon white border0 border-radius0"> 10 <i class="iconfont"></i> 11 </div> 12 </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]) ?>
1 $("#begin_date").datepicker({ 2 format: ‘yyyy-mm-dd‘, 3 language: ‘zh-CN‘, 4 autoclose: true, 5 }).on(‘show‘, function () { 6 var $datepick = $(".datepicker"); 7 var bottom = $datepick.position().bottom; 8 });
增加点击事件
1 /* datepicker bind icon show*/ 2 $(function(){ 3 $(".input-group-addon").click(function(){ 4 $(this).prev().find("input").focus(); 5 }) 6 });
时间: 2024-10-11 23:52:08