jquery常用操作
2010-01-29 23:27
274 查看
操作下拉列表
添加选项列表
$(this).get(0).options.add(new Option(text,value));
清空列表
$(this).get(0).options.length=0;
删除指定索引的选项
$(this).get(0).remove(index);
设定需要选中项的值
$(this).get(0).value=value;
获取当前选中选项的文本
$(this).get(0).options[index].text;
批量修改CSS
$(this).css({left:"35px",top:"24px"})
使指定区域内的元素不可使用(变灰)
$(this).find(*).each(function(){$(this).attr("disabled",true);
//遍历select option
$("#seltype>option").length;//长度
//获取select 的长度
return jQuery(this).get(0).options.length;
$(this).get(0).remove(i);删除
$("#seltype option[text='3']").remove();
$("#seltype option:last").remove();//删除最后一项
//将选中的值追加到另一个select
$("#seltype option:selected").appendTo("#selcategory");
添加选项列表
$(this).get(0).options.add(new Option(text,value));
清空列表
$(this).get(0).options.length=0;
删除指定索引的选项
$(this).get(0).remove(index);
设定需要选中项的值
$(this).get(0).value=value;
获取当前选中选项的文本
$(this).get(0).options[index].text;
批量修改CSS
$(this).css({left:"35px",top:"24px"})
使指定区域内的元素不可使用(变灰)
$(this).find(*).each(function(){$(this).attr("disabled",true);
//遍历select option
$("#seltype>option").length;//长度
//获取select 的长度
return jQuery(this).get(0).options.length;
$(this).get(0).remove(i);删除
$("#seltype option[text='3']").remove();
$("#seltype option:last").remove();//删除最后一项
//将选中的值追加到另一个select
$("#seltype option:selected").appendTo("#selcategory");
相关文章推荐
- 汇总常用的jQuery操作Table tr td方法
- jQuery表单常用操作收藏
- jQuery操作表单常用控件方法小结
- 160726、jQuery常用操作
- JQUERY 常用操作总结
- Jquery 常用操作
- jQuery常见操作实现和常用函数方法总结
- 分享jQuery封装好的一些常用操作
- 常用的前台设计 JQuery操作table
- JQuery 常用操作代码
- jquery常用操作
- jquery的常用操作
- JQuery 常用DOM操作3
- jQuery常用操作部分总结
- Jquery操作表单Select元素常用方法
- jquery操作字符串常用方法总结及工作代码
- jquery对dom的操作常用方法整理
- jQuery操作表格(table)的常用方法、技巧汇总
- jquery操作input、select、checkbox、radio常用方法
- Jquery常用操作