Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM renameNode() method

HTML DOM renameNode() method

Document Object Reference Document Object

Example

Rename the p element:

var p=document.getElementsByTagName("P")[0];

document.renameNode(p,null,"h1");


Definition and Usage

The renameNode() method renames an existing element node or attribute node.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Currently no major browser supports the renameNode() method.


Syntax

document.renameNode(

node

,

namespaceURI

,

nodename

)

Parameters

Parameters Type Description
node Node object Required. The node object that needs to be renamed.
namespaceURI String Required. If you do not want to specify a namespace URI, the node can be set to null .
nodename String Required. The new node name.

Return Value

Type Description
Node object Rename the node

Technical Details

DOM version Core Level 3 Document object

Document Object Reference Document Object