下拉框无限级联

$( ".selectMe").live('change', function(){
     $( this).nextAll( ".selectMe").remove();
     document.getElementById( "warning").innerHTML="";
     var url = "<%=path%>/dept/getNextDeptInfo.action?deptId="+$( this).val();
     var obj=$( this);
     $.getJSON(url, null, function call(data) {
         if(data!= null&&data!=""&&data.deptList.length>0){
         var str= "<select    class='selectMe' name='countInfo.deptId'><option value=''>请选择</option> ";
         for( var i=0;i<data.deptList.length;i++){
            str+= "<option    value='"+data.deptList[i].deptId+ "'>"+data.deptList[i].deptName+ "</option>";
        }
        str+= "</select>";
        obj.after(str);
        }
     });
     getPerson($( this).val());
    });

<select class= "selectMe" >

<option value="1">sss
</option
<option value="2">ssswww
</option
</select>

你可能感兴趣的:(function,change)