Name

Element.removeAttributeNode( ) — remove an Attr node from an element

Availability

DOM Level 1 Core

Synopsis

Attr removeAttributeNode(Attr oldAttr)
    throws DOMException;

Arguments

oldAttr

The Attr node to be removed from the element.

Returns

The Attr node that was removed.

Throws

This method may throw a DOMException with the following code values:

NO_MODIFICATION_ALLOWED_ERR

This element is read-only and does not allow attributes to be removed.

NOT_FOUND_ERR

oldAttr is not an attribute of this element.

Description

This method removes (and returns) an Attr node from the set of attributes of an element. If the removed attribute has a default value specified by the DTD, a new Attr is added representing this default value. If is often simpler to use removeAttribute( ) instead of this method.

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.