jQuery练习t190,从0到1
作者:互联网
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
.content{
color: red;
font-weight: bold;
}
</style>
<script src="../js/jquery-3.5.1.js"></script>
<script>
$(function () {
//属性操作
//删除属性,removeAttr("属性名")
$("p").click(function () {
$(this).removeAttr("class");
});
$("#btn1").click(function () {
$("p").removeAttr("class");
});
});
</script>
</head>
<body>
<p class="content">虾米大王</p>
<input type="button" id="btn1" value="删除">
</body>
</html>
标签:jQuery,function,removeAttr,练习,t190,click,class,属性 来源: https://blog.csdn.net/modern358/article/details/113463723