removeNamedItem method (Internet Explorer)

Switch View :
ScriptFree
removeNamedItem method

[This documentation is preliminary and is subject to change.]

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

Document Object Model (DOM) Level 3 Core Specification, Section 1.4

Syntax

var retval = attributes.removeNamedItem(bstrName);

Standards information

Parameters

bstrName [in]

Type: BSTR

A String that specifies the name of an attribute to remove.

Return value

Type: ObjectReturns 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. This method returns a script error if the user attempts to remove a non-existent attribute node.

removeNamedItem was introduced in Microsoft Internet Explorer 6.

Examples

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

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/removeNamedItemEx1.htm


<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>


 

 

Build date: 2/14/2012