加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

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

发布时间:2020-05-23 11:41:34 所属栏目:PHP 来源:互联网
导读:这篇文章主要介绍了Yii2使用dropdownlist实现地区三级联动功能的方法,结合实例形式较为详细的分析了dropdownlist下拉列表实现三级联动调用的具体步骤与相关注意事项,需要的朋友可以参考下

本文实例讲述了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("
    推荐文章
      热点阅读