jQuery 增加 删除 修改select option
来源:互联网 发布:javascript join方法 编辑:程序博客网 时间:2024/04/28 22:12
1. var checkText=jQuery("#select_id").find("option:selected").text(); //获取Select选择的Text
2. var checkValue=jQuery("#select_id").val(); //获取Select选择的option Value
3. var checkIndex=jQuery("#select_id ").get(0).selectedIndex; //获取Select选择的索引值
4. var maxIndex=jQuery("#select_id option:last").attr("index"); //获取Select最大的索引值
jQuery添加/删除Select的Option项:
1. jQuery("#select_id").append("<option value='Value'>Text</option>"); //为Select追加一个Option(下拉项)
2. jQuery("#select_id").prepend("<option value='0'>请选择</option>"); //为Select插入一个Option(第一个位置)
3. jQuery("#select_id option:last").remove(); //删除Select中索引值最大Option(最后一个)
4. jQuery("#select_id option[index='0']").remove(); //删除Select中索引值为0的Option(第一个)
5. jQuery("#select_id option[value='3']").remove(); //删除Select中Value='3'的Option
6. jQuery("#select_id option[text='4']").remove(); //删除Select中Text='4'的Option
内容清空:
jQuery("#select_id").empty();
转自:http://blog.csdn.net/lgh1117/article/details/7199186
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option .
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option .
- jQuery 增加 删除 修改select option
- jQuery增加、删除 、修改select option
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option
- jQuery 增加 删除 修改select option
- JQuery Select 删除Option
- SELECT OPTION 向上、下移动、增加、删除
- jQuery操作select下拉框(增加,删除,修改)
- Time
- 回调函数的概念及使用案例
- Java Excel操作控件JExcel
- C++语言产生随机数的函数
- POJ 1088 滑雪 -- 动态规划
- jQuery 增加 删除 修改select option
- android截屏代码
- Android 基础之广播总结
- 学生成绩分析管理系统
- ubuntu
- Nehe第七课-光照和键盘控制
- css布局学习笔记之box-sizing
- SQL注入漏洞
- [经验分享] 精通android体系架构、mvc、常见的设计模式、控制反转(ioc)