在html中,我们根据id为type的select控件值的变化,动态变化business,city,district的显示情况。
在table中控制tr的显示与隐藏时,不要用$(".business").css(display, "block"),这样会使tr的显示出现问题,用hide和show即可。
$("#type").change(function(){ var type = $("#type option:selected").val(); if(type=="0"){ $(".business").hide(); } if( type=="1"){ $(".business").hide(); $(".province").show(); } if( type=="2"){ $(".business").hide(); $(".city").show(); } if( type=="3"){ $(".business").hide(); $(".district").show(); } if( type=="4"){ $(".business").show(); } });