核心代码是 $(data.othis).parents('.layui-item').find("select[name='ProjectType[]']").html(html);
完全代码
form.on('select(type)', function(data){console.log(data);var z=data.value;if(z==null || z==""){var h="<option value=''>请选择</option>";$(data.othis).parents('.layui-item').find("select[name='ProjectType[]']").html(h);//layui.$("select[name='ProjectType[]']").html(h);form.render('select');return false;}var arr={'code':z};layui.$.ajax({type: 'POST',dataType: 'json',url: '/index.php/competition2022/matchTypeList',data:arr}).done(function (result) {if(result!=null){var html="<option value=''>请选择</option>";layui.$.each(result,function(n,value){html +="<option value='"+value.Code+"'>"+value.Name+"</option>";});$(data.othis).parents('.layui-item').find("select[name='ProjectType[]']").html(html);//layui.$("select[name='ProjectType[]']").html(html);form.render('select');}});});
