How to use DOM Element RemoveAttributeNode in JavaScript
In this article I am going to explain about DOM Element removeAttributeNode() method in JavaScript.
JavaScript DOM Element removeAttributeNode() Method
JavaScript removeAttributeNode() method use for remove attribute with specified tag name and return the removed attribute.
Syntax
element.removeAttributeNode(attribute)
|
Example
<html>
<head>
<h1 style="color: blue">
Hello India</h1>
<script type="text/javascript">
function myfun() {
var mm = document.getElementsByTagName("H1")[0];
var ss = mm.getAttributeNode("style");
mm.removeAttributeNode(ss);
};
</script>
</head>
<body>
<p id="demo">
click button for remove attribute</p>
<button onclick="myfun()">
click me</button>
</body>
</html>
|
Output
Before click
After click
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here