X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM getAttributeNode() Method

Element Object Reference Element Object

Example

Return the target attribute of a link:

document.getElementsByTagName("a")[0].getAttributeNode("target");

Try it yourself »


Definition and Usage

The getAttributeNode() method returns the attribute with the specified name, as an Attr object.

Tip: Use the getAttribute if you just want to return the attribute value.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The getAttributeNode() method is supported in all major browsers.


Syntax

element.getAttributeNode(attributename)

Parameters

Parameter 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 Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook