常用html控件的js用法
2017-01-04 15:27
316 查看
记录一些常用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);
}
});
}
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);
}
});
}
相关文章推荐
- js中常用日期控件WdatePicker介绍和用法详解
- 常用的JS与XML结合用法 简单示例
- JavaScript封装的常用工具类库bee.js用法详解【经典类库】
- prototype.js常用函数及其用法
- prototype.js常用函数及其用法
- prototype.js常用函数及其用法
- HTML控件用法
- prototype.js常用函数及其用法
- 基础的prototype.js常用函数及其用法
- Html控件-Dropdown的用法
- VC常用控件用法
- 常用控件Radio Button的常用用法
- 常用的JS与XML结合用法 简单示例
- prototype.js常用函数及其用法
- 基础的prototype.js常用函数及其用法
- 基本常用控件基本用法
- 常用控件Radio Button的常用用法
- prototype.js常用函数及其用法
- html控件select的用法,这么easy的问题竟然今天刚刚发现
- prototype.js常用函数及其用法