aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/element/removeattribute/index.html
blob: d31f6ded75ea8c83e589b49dd8e667659fab2b96 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
title: Element.removeAttribute()
slug: Web/API/Element/removeAttribute
tags:
  - API
  - DOM
  - Element
  - Method
  - Reference
translation_of: Web/API/Element/removeAttribute
---
<div>{{APIRef("DOM")}}</div>

<p><span class="seoSummary"><code><strong>Element.removeAttribute()</strong></code> 메서드는 요소에서 주어진 이름의 특성을 제거합니다.</span></p>

<h2 id="구문">구문</h2>

<pre class="syntaxbox"><em>element</em>.removeAttribute(<em>attrName</em>);
</pre>

<h3 id="매개변수">매개변수</h3>

<dl>
 <dt><code>attrName</code></dt>
 <dd>요소에서 제거할 특성 이름을 지정하는 {{domxref("DOMString")}}. 지정하지 않으면 오류 없이 아무 동작도 하지 않습니다.</dd>
</dl>

<h3 id="반환_값">반환 값</h3>

<p>{{jsxref("undefined")}}.</p>

<h2 id="사용_일람">사용 일람</h2>

<p>많은 특성은 {{jsxref("null")}}을 대입했을 때 예상치 못한 동작을 하곤 합니다. 그러므로 특성을 삭제할 때 <code>null</code>을 직접 대입하거나, {{domxref("Element.setAttribute", "setAttribute()")}}의 매개변수로 제공하기보단 <code>removeAttribute()</code> 메서드를 사용해야 합니다.</p>

<h2 id="예제">예제</h2>

<pre class="brush: js">// Given: &lt;div id="div1" align="left" width="200px"&gt;
document.getElementById("div1").removeAttribute("align");
// Now: &lt;div id="div1" width="200px"&gt;
</pre>

<h2 id="Specification" name="Specification">명세</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('DOM WHATWG', '#dom-element-removeattribute', 'Element" removeAttribute')}}</td>
   <td>{{Spec2('DOM WHATWG')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>

<h2 id="브라우저_호환성">브라우저 호환성</h2>



<p>{{Compat("api.Element.removeAttribute")}}</p>