go
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

removeNamedItem method

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

Parameters

bstrName [in]

Type: BSTR

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

Return value

Type: IHTMLDOMAttribute

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

Standards information

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>


See also

attributes

 

 

Send comments about this topic to Microsoft

Build date: 11/27/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.