Element.removeAttributeNode

  • Revision slug: DOM/element.removeAttributeNode
  • Revision title: element.removeAttributeNode
  • Revision id: 71265
  • Created:
  • Creator: Brettz9
  • Is current revision? No
  • Comment 2 words added, 19 words removed; page display name changed to 'element.removeAttributeNode'

Revision Content

{{ DomRef() }}

Summary

removeAttributeNode removes the specified attribute from the current element.

Syntax

removedAttr = element.removeAttributeNode(attributeNode)
  • attributeNode is the Attr node that needs to be removed.
  • removedAttr is the removed Attr node.

Example

// <div id="top" align="center" />
var d = document.getElementById("top"); 
var d_align = d.getAttributeNode("align"); 
d.removeAttributeNode(d_align); 
// align is now removed: <div id="top" />

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)

{{ languages( { "fr": "fr/DOM/element.removeAttributeNode", "ja": "ja/DOM/element.removeAttributeNode", "pl": "pl/DOM/element.removeAttributeNode" } ) }}

Revision Source

<p>{{ DomRef() }}</p>
<h3 name="Summary">Summary</h3>
<p><code>removeAttributeNode</code> removes the specified attribute from the current element.</p>
<h3 name="Syntax">Syntax</h3>
<pre class="eval"><em>removedAttr</em> = <em>element</em>.removeAttributeNode(<em>attributeNode</em>)
</pre>
<ul> <li><code>attributeNode</code> is the <code>Attr</code> node that needs to be removed.</li> <li><code>removedAttr</code> is the removed <code>Attr</code> node.</li>
</ul>
<h3 name="Example">Example</h3>
<pre>// &lt;div id="top" align="center" /&gt;
var d = document.getElementById("top"); 
var d_align = d.getAttributeNode("align"); 
d.removeAttributeNode(d_align); 
// align is now removed: &lt;div id="top" /&gt;
</pre>
<h3 name="Notes">Notes</h3>
<p>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.</p>
<p>{{ DOMAttributeMethods() }}</p>
<h3 name="Specification">Specification</h3>
<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-D589198">DOM Level 2 Core: removeAttributeNode</a> (introduced in <a class="external" href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-removeAttributeNode">DOM Level 1 Core</a>)</p>

<p>{{ languages( { "fr": "fr/DOM/element.removeAttributeNode", "ja": "ja/DOM/element.removeAttributeNode", "pl": "pl/DOM/element.removeAttributeNode" } ) }}</p>
Revert to this revision