jquery 常用操作方法
作者:bea
操作下拉列表 添加选项列表 $(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).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)});
有用 |
无用
添加选项列表
$(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)});
猜你喜欢
您可能感兴趣的文章:
- 对字符串进行HTML编码和解码的JavaScript函数
- javaScript 关闭浏览器 (不弹出提示框)
- javascript让setInteval里的函数参数中的this指向特定的对象
- 详细讲解JS节点知识
- javascript中的array数组使用技巧
- jquery 批量上传图片实现代码
- Jquery 常用方法经典总结
- javascript 匿名函数的理解(透彻版)
- JavaScript 学习笔记(十五)
- Extjs 几个方法的讨论
- JavaScript 判断判断某个对象是Object还是一个Array
- 图像替换新技术 状态域方法
- javascript innerText和innerHtml应用
- js 右键菜单,支持不同对象不同菜单(兼容IE、Firefox)
- 使用JavaScript库还是自己写代码?
- js或css实现滚动广告的几种方案
- jquery中的sortable排序之后的保存状态的解决方法
- javascript面向对象的方式实现的弹出层效果代码
- js提示信息jtip封装代码,可以是图片或文章