HTML DOM removeAttributeNode()Method
Examples
Remove the attribute node of the header element:
var n=document.getElementsByTagName("INPUT")[0];
var a=n.getAttributeNode("type");
n.removeAttributeNode(a)
var a=n.getAttributeNode("type");
n.removeAttributeNode(a)
Before removing the attribute:
Hello World
After removing the attribute:
Hello World
Try it Yourself »
Definition and Usage
The removeAttributeNode() method removes the specified attribute node from an element.
This method removes (and returns) an Attr node from the current element's attribute collection. If the DTD sets a default value for the removed attribute, this method will add a new Attr node to represent that default value. It is often simpler to use the removeAttribute() method instead of this method.
You can refer toremoveAttribute()method.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the removeAttributeNode() method, except Internet Explorer.
Syntax
element.removeAttributeNode(attributenode)
Parameters
| Parameter | Type | Description |
|---|---|---|
| attributenode | Attr object | Required. The attribute node you want to remove. |
Return Value
| Type | Description |
|---|---|
| Attr Object | The removed attribute node |
Technical Details
| DOM Version | Core Level 1 Element Object |
|---|
Other Extensions
Element Object