jquery 常用操作方法
(编辑:jimmy 日期: 2025/5/11 浏览:3 次 )
操作下拉列表
添加选项列表
$(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)});
下一篇:jquery 经典动画菜单效果代码