Bootstrap 下拉选择框的实现

施鸿
2023-12-01
<select class="form-control" id="hospitalCodeSelect"  >
	<option value="" ></option>
</select>
function showHospitalCode(){
            	$.ajax({
					url:"${TTC}/departmentInfo/getHospitalCodeList.do",//跳转到控制器HospitalController
					type:"POST",
					success:function(hospitals) {

							var content = '';
							$.each(hospitals,function(i,n){
								content += "<option value='" + n.namecode + "'>"+ n.name+"</option>";
							});
							//选择列表,选中的值赋值到hospitalCode;
							$("#hospitalCodeSelect").html(content).trigger("chosen:updated").change(function () {
								hospitalCode=$("#hospitalCodeSelect option:selected").val();
							})
					}
				})
			}

然后把方法放在

 类似资料: