removeAttributeNode() 예제
<style> .hz {color: red;} </style> <h1 class="hz">홈짱닷컴 Homzzang.com</h1> <button onclick="homzzang()">클릭</button> <script> function homzzang() { var h1 = document.getElementsByTagName("H1")[0]; var att = h1.getAttributeNode("class"); h1.removeAttributeNode(att); } </script> 결과보기
<style>
.hz {color: red;}
</style>
<h1 class="hz">홈짱닷컴 Homzzang.com</h1>
<button onclick="homzzang()">클릭</button>
<script>
function homzzang() {
var h1 = document.getElementsByTagName("H1")[0];
var att = h1.getAttributeNode("class");
h1.removeAttributeNode(att);
}
</script>
결과보기