Javascript examples for DOM:Element removeAttributeNode
The removeAttributeNode() method removes attribute and returns the removed attribute as an Attr Node object.
Parameter | Type | Description |
---|---|---|
attributenode | Attr object | Required. The attribute node |
An Attr object, representing the removed attribute node
The following code shows how to Remove the href attribute node from an <a> element:
<!DOCTYPE html> <html> <body> <a id="myAnchor" href="http://www.java2s.com">A Link: go to java2s.com</a> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from ww w .jav a 2 s . com var elmnt = document.getElementById("myAnchor"); var attr = elmnt.getAttributeNode("href"); elmnt.removeAttributeNode(attr); } </script> </body> </html>