HTML DOM removeNamedItem()Method

属性对象参考手册Attribute Object

Examples

Remove the type attribute of a button:

var btn=document.getElementsByTagName("INPUT")[0]; btn.attributes.removeNamedItem("type");

Before removing the attribute:

After removing the attribute:


Try it yourself »

Definition and Usage

The removeNamedItem() method removes the specified node.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the removeNamedItem() method

Note:In Internet Explorer 8 and earlier IE versions, when using the removeNamedItem() method to remove an attribute, the method cannot remove the attribute, but it can return the attribute value.


Syntax

namednodemap.removeNamedItem(nodename)

Parameter

Parameter Type Description
nodename String Required. The name of the node you want to remove from the node list.

Return Value

Type Description
Node object The removed node

Technical Details

DOM Version Core Level 1


属性对象参考手册Attribute Object

Other Extensions