--- title: element.removeAttributeNode slug: Web/API/Element/removeAttributeNode tags: - DOM - Gecko - 翻訳中 translation_of: Web/API/Element/removeAttributeNode ---

{{ ApiRef("DOM") }}

Summary

removeAttributeNode removes the specified attribute from the current element.

Syntax

removedAttr =element.removeAttributeNode(attributeNode)

Example

// <div id="top" align="center" />
var d = document.getElementById("top");
var d_align = d.getAttributeNode("align");
d.removeAttributeNode(d_align);
// align has a default value, center,
// so the removed attribute is immediately
// replaced: <div id="top" align="center" />

Notes

If the removed Attribute has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix, when applicable.

{{ DOMAttributeMethods() }}

Specification

DOM Level 2 Core: removeAttributeNode (introduced in DOM Level 1 Core)