加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

Yii2使用dropdownlist实现地区三级联动功能的方法

发布时间:2020-12-12 21:38:17 所属栏目:PHP教程 来源:网络整理
导读:本篇章节讲解Yii2使用dropdownlist实现地区三级联动功能的方法。供大家参考研究具体如下: 视图部分: ['index'],'method' => 'get','options' => ['class' => 'form-inline'] ]); ?> field($model,'cityName',['options' => ['class' => 'form-gr

本篇章节讲解Yii2使用dropdownlist实现地区三级联动功能的方法。分享给大家供大家参考,具体如下:

视图部分:

['index'],'method' => 'get','options' => ['class' => 'form-inline'] ]); ?> field($model,'cityName',['options' => ['class' => 'form-group col-lg-2']])->dropDownList(ArrayHelper::map($cities,'id','name'),['prompt' => '请选择城市'])->label('请选择城市',['class' => 'sr-only']) ?> field($model,'areaName',['options' => ['class' => 'form-group col-lg-2']])->dropDownList(ArrayHelper::map($areas,['prompt' => '请选择区县'])->label('请选择区县','communityName',['options' => ['class' => 'form-group col-lg-2']])->dropDownList(ArrayHelper::map($communities,['prompt' => '请选择小区'])->label('请选择小区',['class' => 'sr-only']) ?>

'btn btn-primary']) ?>

registerJs(' //市地址改变 $("#itemsearch-cityname").change(function() { //市id值 var cityid = $(this).val(); $("#itemsearch-areaname").html("
    推荐文章
      热点阅读