记录一些常用html控件的js用法
1、下拉框
下拉框设置text选中,类似 $("#select option[text='xxx']").attr("selected", true); 亲测为错误写法,并不能生效
function initSelector(ddl, text) {
$("#" + ddl + " option").each(function (i, item) {
if ($(item).text() == text) {
$(item).attr("selected", true);
}
});
}