HTML DOM getAttributeNode() method
Example
Return the target attribute of the link:
document.getElementsByTagName("a")[0].getAttributeNode("target");
Try it »
Definition and Usage
The getAttributeNode() method gets an attribute node by name from the current element.
**Tip:** If you only want to return the attribute value, please use the getAttribute method.
Browser support





All major browsers support the getAttributeNode() method
Syntax
element
.getAttributeNode(
attributename
)
Parameters
| Parameters | Type | Description |
|---|---|---|
| attributename | String | Required. The name of the attribute you want to return. |
Return Value
| Type | Description |
|---|---|
| Attr object | The specified attribute node |
Technical Details
| DOM version | Core Level 1 Element Object |
|---|
Element object