X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM getNamedItem() Method

Attribute Object Reference Attribute Object

Example

Get the value of the onclick attribute of a button element:

var btn = document.getElementsByTagName("BUTTON")[0];
btn.attributes.getNamedItem("onclick").textContent;

The result of btn could be:

myFunction()

Try it yourself »


Definition and Usage

The getNamedItem() method returns the attribute node with the specified name from a NamedNodeMap object.


Browser Support

The numbers in the table specify the first browser version that fully supports the method.

Method
getNamedItem() Yes 9.0 Yes Yes Yes


Syntax

namednodemap.getNamedItem(name)

Parameter Values

Parameter Type Description
nodename String Required. The name of the node in the namedNodeMap you want to return

Technical Details

Return Value: A Node object, representing the attribute node with the specified name
DOM Version Core Level 1


Attribute Object Reference Attribute Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook