二级联动(list对象中存list对象)


var platformListJson = '${platformListJson}';
var shopPlatformHtml='';
$(JSON.parse(platformListJson)).each(function (i, o) {
shopPlatformHtml+='<option value="'+o.code+'" shopList='+JSON.stringify(o.shopList)+'>'+o.name+'</option>';
});
$('#shopPlatform').html(shopPlatformHtml).change(function(){
var shopList=JSON.parse($(this).find('option:selected').attr('shopList'));
var shopCodeHtml='';
$(shopList).each(function(i,o){
shopCodeHtml+='<option value="'+o.shopId+'">'+o.shopName+'</option>';
});
$('#shopCode').html(shopCodeHtml);
}).change();

posted @ 2018-10-16 10:29  夏末之至  阅读(390)  评论(0编辑  收藏  举报