blob: b85d06ff169115d0ff608188c40c223fff0c3def (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
---
title: element.removeAttributeNode
slug: Web/API/Element/removeAttributeNode
tags:
- DOM
- Gecko
- 翻訳中
translation_of: Web/API/Element/removeAttributeNode
---
<p>{{ ApiRef("DOM") }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p><code>removeAttributeNode</code> removes the specified attribute from the current element.</p>
<h3 id="Syntax" 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 id="Example" name="Example">Example</h3>
<pre>// <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" />
</pre>
<h3 id="Notes" 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 id="Specification" 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>
|