<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
div {
width: 200px;
height: 200px;
background-color: pink;
}
.cls {
background-color: deeppink;
}
</style>
</head>
<body>
<input type="button" value="移除属性" id="bt"/>
<div score = "10" id="dv" class="cls"></div>
<script src="common.js"></script>
<script>
//点击按钮移除元素的自定义属性
my$("bt").onclick = function () {
my$("dv").removeAttribute("score");
//移除元素的类样式
//值没有了但是属性还有
my$("dv").className = "";
//也可以移除元素自带的属性
my$("dv").removeAttribute("class");
};
</script>
</body>
</html>