引入文件
chosen.css
jquery-1.7.1.min.js
chosen.jquery.js
绑定数据:
for (var i = 0; i < data.length; i++) { $("#ddlExchangeID").append("<option value=\"" + data[i].DictionaryID + "\">" + data[i].DictionaryName + "</option>"); } $("#ddlExchangeID").chosen();
$("#ddlExchangeID").trigger("liszt:updated");
初始化选定数据
$("#ddlExchangeID option[value='" + data.Source + "']").attr("selected", "selected");
$("#ddlExchangeID").chosen();
$("#ddlExchangeID").trigger("liszt:updated");