HTML DOM renameNode()Method
Examples
Rename the p element:
var p=document.getElementsByTagName("P")[0];
document.renameNode(p,null,"h1");
document.renameNode(p,null,"h1");
Definition and Usage
The renameNode() method renames an existing element node or attribute node.
Browser Support
![]()
![]()
![]()
![]()
![]()
No major browser currently supports the renameNode() method.
Syntax
document.renameNode(node,namespaceURI,nodename)
Parameters
| Parameters | Type | Description |
|---|---|---|
| node | Node object | Required. The node object to rename. |
| namespaceURI | String | Required. If you do not want to specify, you can set the namespace URI of the node to null.null 。 |
| nodename | String | Required. The new node name. |
Return Value
| Type | Description |
|---|---|
| Node object | The renamed node. |
Technical Details
| DOM Version | Core Level 3 Document Object |
|---|
Other Extensions
Document Object