HTML DOM renameNode() Method
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML DOM renameNode() Method

❮ Document Object

Example

Rename a <p> element:

var p = document.getElementsByTagName("P")[0];
document.renameNode(p, null, "h1");

Definition and Usage

The renameNode() method renames nodes of type Element and Attr.


Browser Support

Method
renameNode() Not supported Not supported Not supported Not supported Not supported

Syntax

document.renameNode(node, namespaceURI, nodename)

Parameter Values

Parameter Type Description
node Node object Required. The node object you want to rename
namespaceURI String Required, but can be set to null if you do not want to specify the namespace URI of the node
nodename String Required, the new nodename

Technical Details

Return Value: A Node object, representing the renamed node
DOM Version Core Level 3 Document Object

❮ Document Object