博客
关于我
给select赋值过程
阅读量:400 次
发布时间:2019-03-05

本文共 1411 字,大约阅读时间需要 4 分钟。

set_province();     $("select").each(function () {               var                $ele=$(this),             str = "@Model.personalDatas.personalDataAddress";                   var   $value = str.split("|");                       $ele.find("option[value = '" + $value[0] + "']").attr("selected", "selected");               var index = $ele.find("option[value = '" + $value[0] + "']").index();               var data_region = region[index + 1];                city.length = 1;                for (var i in data_region['child']) {                       city[i] = new Option(data_region['child'][i].name, data_region['child'][i].name);                }             $ele.find("option[value = '" + $value[1] + "']").attr("selected", "selected");                         console.log(province.selectedIndex);          var data_region1 = region[province.selectedIndex + 1]['child'][city.selectedIndex]['child'];        zone.length = 1;          for (var i in data_region1) {               for (var j in data_region1[i]) {                   zone[j] = new Option(data_region1[i][j].name, data_region1[i][j].name);             }         }         $ele.find("option[value = '" + $value[2] + "']").attr("selected", "selected");         $("#address").val($value[3]);        });    //验证

注:set_province();

方法是:

function set_province() {

for (var i in region) {
province[i - 1] = new Option(region[i].name, region[i].name);
}
}

转载地址:http://gitzz.baihongyu.com/

你可能感兴趣的文章
no1
查看>>
NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
查看>>
NOAA(美国海洋和大气管理局)气象数据获取与POI点数据获取
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
node
查看>>
node exporter完整版
查看>>
node HelloWorld入门篇
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node JS: < 二> Node JS例子解析
查看>>
Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime(93)解决
查看>>
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime(72)
查看>>
Node 裁切图片的方法
查看>>
node+express+mysql 实现登陆注册
查看>>
Node+Express连接mysql实现增删改查
查看>>
node, nvm, npm,pnpm,以前简单的前端环境为什么越来越复杂
查看>>
Node-RED中Button按钮组件和TextInput文字输入组件的使用
查看>>
vue3+Ts 项目打包时报错 ‘reactive‘is declared but its value is never read.及解决方法
查看>>
Node-RED中Switch开关和Dropdown选择组件的使用
查看>>
Node-RED中使用exec节点实现调用外部exe程序
查看>>
Node-RED中使用function函式节点实现数值计算(相加计算)
查看>>