Search w3schools.com:

SHARE THIS PAGE

DOM Node localName Property

Node Object Reference Node Object

Example

Get the local name of the body element:

document.body.localname;

The result will be:

body

Try it yourself »

Definition and Usage

The localName property returns the local name of the specified node.

The localName property returns the name of element nodes and attribute nodes, for other node types the return value is null.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The localName property is supported in all major browsers.

Note: Internet Explorer 8 and earlier does not support this property.


Syntax

node.localName

Technical Details

Return Value: A String, representing the name of the node
DOM Version Core Level 2


Node Object Reference Node Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]