Latest web development tutorials

HTML DOM renameNode () method

Document Object Reference Document Object

Examples

Rename p elements:

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

Definition and Usage

renameNode () method to rename the existing element node or attribute node.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

There is no major browsers support renameNode () method.


grammar

document.renameNode( node , namespaceURI , nodename )

parameter

参数 类型 描述
node Node 对象 必须。需要重命名的节点对象。
namespaceURI String 必须, 如果你不想指定可以设置 namespace URI的节点可以设置为 null
nodename String Required, the new nodename

return value

类型 描述
Node 对象 重命名节点

technical details

DOM version Core Level 3 Document Object


Document Object Reference Document Object