使用easydropdown固定需要三个文件:easydropdown.css、jquery.easydropdown.js、jquery-2.0.3.min.js
html 中 使用样式(class="dropdown"):
<select name="tm_type_select" id="tm_type_select" class="dropdown" value="" οnchange="selectTmType()">
<option value="" >题目类型</option>
</select>
js通过ajax获取数据后,加入下拉框中,再调用easydropdown事件:
success : function(result) {
var html = "";
for(var i in result ){
html += "<option value='" + i + "'>" + result[i] + "</option>"
}
$("#tm_type_select").append(html);
$("#tm_type_select").easyDropDown("destroy"); // 必不可少,因为前端样式已经变成ul和li了,所以必须先销毁一遍.
$("#tm_type_select").easyDropDown();
},