代码示例:(标识:jsck_element_removeattribute_1)
<!DOCTYPE html>
<html>
<head>
<style>
.democlass {
  color: red;
}
</style>
</head>
<body>

<h1 class="democlass">Hello World</h1>

<p id="demo">单击按钮从 h1 元素中删除 class 属性。</p>

<button onclick="myFunction()">试一试</button>

<script>
function myFunction() {
  document.getElementsByTagName("H1")[0].removeAttribute("class"); 
}
</script>

</body>
</html>
运行结果: