Element.removeAttributeNode() removes a specified Attr node from the element and returns that removed node (MDN). Prefer removeAttribute() when you only need to delete by name.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call el.removeAttributeNode. Start with this line.
JavaScript
el.removeAttributeNode(attr)
Call
What it does
el.removeAttributeNode(attr)
Primary signature.
el.removeAttributeNode(...)
Call with the arguments your case needs.
Built into the browser. Call removeAttributeNode(...) on an Element — no import required.
Safer path: null-check getAttributeNode, or use removeAttribute(name).
Compatibility
Browser Support
Element.removeAttributeNode() is Baseline Widely available on MDN (across browsers since July 2015). Safe for Attr-node workflows.
✓ Baseline Widely available
Element.removeAttributeNode()
Remove an Attr node and get it back — widely supported.
WideBaseline
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
removeAttributeNode()Widely available
Bottom line: Use when you already have an Attr. Prefer removeAttribute(name) for everyday deletes by name.
Frequently Asked Questions
It removes the specified Attr node from the element and returns that removed Attr node (MDN).
No. MDN marks Element.removeAttributeNode() as Baseline Widely available (across browsers since July 2015). It is not Deprecated, Experimental, or Non-standard.
An Attr node — typically obtained first with getAttributeNode() or from element.attributes (MDN).
The Attr node that was removed from the element (MDN).
MDN: if you do not need to inspect the Attr node before removing it, removeAttribute(attrName) is simpler.
NotFoundError DOMException when the element's attribute list does not contain the specified Attr node (MDN).