removeNamedItem method
Removes an attribute specified with the name property from an element by using the attributes collection.
![]() |
Syntax
var retval = attributes.removeNamedItem(bstrName);Parameters
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
Send comments about this topic to Microsoft
Build date: 11/27/2012
