var province=$("#province"),city=$("#city"),town=$("#town"); for(var i=0;i"+value+""; ele.append(optionStr); } function removeEle(ele){ ele.find("option").remove(); var optionStar=""; ele.append(optionStar); } var provinceText,cityText,cityItem; province.on("change",function(){ provinceText=$(this).val(); $.each(provinceList,function(i,item){ if(provinceText == item.name){ cityItem=i; return cityItem } }); removeEle(city); removeEle(town); $.each(provinceList[cityItem].cityList,function(i,item){ addEle(city,item.name) }) }); city.on("change",function(){ cityText=$(this).val(); removeEle(town); $.each(provinceList,function(i,item){ if(provinceText == item.name){ cityItem=i; return cityItem } }); $.each(provinceList[cityItem].cityList,function(i,item){ if(cityText == item.name){ for(var n=0;n