Js中读取、移除属性及隐藏组件方法研究
来源:互联网 发布:mysql 官网下载旧版本 编辑:程序博客网 时间:2024/05/16 11:03
添加、移除组件属性方法:
$(".class名").attr("属性名","属性值");//设置指定属性
$(".class名").attr("属性名");//读取指定属性值 or document.getElementById("id值").getAttribute("属性名");
$(".class名").removeAttr("属性名");//移除该class组件对应的该属性值
隐藏某控件方法:
/*此方法不仅隐藏该组件还可隐藏该组件所占位置*/
$(".class名").attr("style", "display:none"); or document.getElementById("id值").style.display = "none";
/*此方法仅隐藏该组件,但不隐藏该组件所占位置*/
$(".class名").attr("style", "visibility:hidden"); or document.getElementById("id值").style.visibility="hidden";
例子:
<form class="form-horizontal" id="timeDeci_form">
<div class="form-group timeDeci_combobox1">
<div class="col-md-10 col-sm-10">
<input name="timeDecision" class="form-control timeDeciCombobox1" />
</div>
<div class="btn-group">
<button type="button" id="add-btn1" class="btn btn-link add-input glyphicon glyphicon-plus"></button>
<button type="button" id="delete-btn1" class="btn btn-link delete-input glyphicon glyphicon-minus" name="1"></button>
</div>
</div>
</form>
可用$(".timeDeci_combobox1").attr("style", "display:none");可隐藏红色部分整个div中的所有内容。
以上内容已做过测试,方法均是可以使用的。
- Js中读取、移除属性及隐藏组件方法研究
- js移除属性
- 常见组件属性及方法
- js将控件隐藏及display属性
- js将控件隐藏及display属性
- js将控件隐藏及display属性
- js将控件隐藏及display属性
- PHP的Yii框架中移除组件所绑定的行为的方法
- JS中定义类及属性方法应用格式
- js中获取属性的三种方法及区别
- js中Prototype属性解释及常用方法
- js中Prototype属性解释及常用方法
- js中Prototype属性解释及常用方法
- 隐藏/移除actionbar
- js.window属性及方法
- js移除option值的方法
- UGUI组件获取及属性设置方法
- CSS中隐藏内容的3种方法及属性值
- 理解CSS中BFC
- vue.js的简单使用及组件套用
- A Neural Algorithm of Artistic Style
- Url编解码
- Kafka入门经典教程
- Js中读取、移除属性及隐藏组件方法研究
- poj 1029
- Winform-my输入框
- 编程语言之前端介绍
- spring xml文件
- docker for windows pull镜像文件的安装位置改变方法
- 牛客:剑指offer:扑克牌顺子 (Java)
- 基于Redis实现分布式锁
- android利用ZXing扫描二维码