removeNamedItem

HTML (DHTML)

removeNamedItem Method

Internet Development Index

Removes an attribute specified with the name property from an element using the attributes collection.

Syntax

newretNode = attributes.removeNamedItem(sName)

Parameters

sName Required. String that specifies the name of an attribute to remove.

Return Value

Returns an attribute removed from the document if successful, otherwise null.

Remarks

An attribute that is removed with this method reverts to the default value of the attribute when applicable.

Example

The following example shows how to use the this method to remove an attribute from an element.

<HTML>
<HEAD>
<SCRIPT>
function removeAttrib()
{
var oAttrColl = myDIV.attributes;
oAttrColl.removeNamedItem("TITLE");
}
</SCRIPT>
</HEAD>
<BODY>
<DIV onclick="removeAttrib();" ID="myDIV" TITLE="THIS IS A TOOLTIP">
Click this DIV and the ToolTip will be inactivated.</DIV>
</BODY>
</HTML>
This feature requires Microsoft® Internet Explorer 6 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

attributes