php8.5
Home/ Manual/ dom / domelement/ DOMElement::removeAttributeNode

DOMElement::removeAttributeNode

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Removes attribute

Description

DOMElement::removeAttributeNode(DOMAttr $attr): DOMAttr|false

Removes attribute attr from the element.

Parameters

attr

The attribute node.

Return Values

Success

Errors/Exceptions

May throw a DOMException with the following error codes:

DOM_NO_MODIFICATION_ALLOWED_ERR

Raised if the node is readonly.

DOM_NOT_FOUND_ERR

Raised if attr is not an attribute of the element.

See Also

  • DOMElement::hasAttribute
  • DOMElement::getAttributeNode
  • DOMElement::setAttributeNode

Source: reference/dom/domelement/removeattributenode.xml · from the official PHP manual (php/doc-en)