jQuery中removeAttr()方法用法实例
本文实例讲述了jQuery中removeAttr()方法用法。分享给大家供大家参考。具体分析如下:
此方法从匹配元素中移除相应的属性。
语法结构:
$(selector).removeAttr(attribute)
参数列表:
实例代码:
<!DOCTYPEhtml>
<html>
<head>
<metacharset="utf-8">
<metaname="author"content="https://www.nhooo.com/"/>
<title>毛票票</title>
<styletype="text/css">
div{
height:200px;
width:200px;
border:1pxsolidblue
}
.reset{
font-size:20px;
color:green;
}
</style>
<scripttype="text/javascript"src="mytest/jQuery/jquery-1.8.3.js"></script>
<scripttype="text/javascript">
$(document).ready(function(){
$("#btn").click(function(){
$("div").removeAttr("class");
})
})
</script>
</head>
<body>
<divclass="reset">毛票票欢迎您</div>
<buttonid="btn">点击查看效果</button>
</body>
</html>
在以上代码中,点击按钮可以删除移除class属性。
希望本文所述对大家的jQuery程序设计有所帮助。
热门推荐
10 感谢韩语老师祝福语简短
11 升职文案高级祝福语简短
12 花童结婚祝福语大全简短
13 向国庆送祝福语简短
14 什么寄语简短祝福语女生
15 客户回礼祝福语大全简短
16 女孩生日祝福语简短创意
17 家长回复节日祝福语简短
18 给外婆敬酒祝福语简短