多级联动
效果展示
$(function(){ $(document).on("change",'.region',function(){ var _this=$(this); var parent_id=_this.val() var str="<select name='address[]' class='region'><option value='0'>请选择..<option>"; if(parent_id!=0){ $.get('?r=house/add',{"pid":parent_id},function(msg){ for(var i=0;i<msg.length;i++){ str+="<option value='"+msg[i]['region_id']+"'>"+msg[i]['region_name']+"</option>"; } if(msg!=""){ str+="</select>"; _this.nextAll().remove(); _this.after(str); } },'json') }else{ _this.nextAll().remove(); } })