aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/globaleventhandlers/onchange/index.html
blob: bbefe1251d54b9f514317bc8a4cd93204741f295 (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
67
68
69
70
71
72
73
---
title: GlobalEventHandlers.onchange
slug: Web/API/GlobalEventHandlers/onchange
tags:
  - API
  - GlobalEventHandlers
  - HTML DOM
  - Property
  - Reference
translation_of: Web/API/GlobalEventHandlers/onchange
---
<div>
<div>{{ ApiRef("HTML DOM") }}</div>
</div>

<p><strong><code>onchange</code></strong> 속성은 {{event("change")}} 이벤트의 이벤트 핸들러를 설정하고 반환합니다.</p>

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

<pre class="syntaxbox"><em><var>target</var></em>.onchange = <em>functionRef</em>;
</pre>

<p><font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">functionRef</span></font><code>null</code> 또는 이벤트 핸들러를 지정하는 <a href="/en-US/docs/Web/JavaScript/Reference/Functions" title="/en-US/docs/JavaScript/Reference/Functions_and_function_scope">JavaScript function</a> 함수 중 하나여야 합니다.</p>

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

<h3 id="HTML">HTML</h3>

<pre class="brush: html"><code>&lt;input type="text" placeholder="Type something here, then click outside of the field." size="50"&gt;
&lt;p id="log"&gt;&lt;/p&gt;</code></pre>

<h3 id="JavaScript">JavaScript</h3>

<pre class="brush: js"><code>let input = document.querySelector('input');
let log = document.getElementById('log');

input.onchange = handleChange;

function handleChange(e) {
  log.textContent = `The field's value is
      ${e.target.value.length} character(s) long.`;
}</code></pre>

<h3 id="결과">결과</h3>

<p>{{EmbedLiveSample("예제")}}</p>

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

<table class="spectable standard-table">
 <tbody>
  <tr>
   <th scope="col">명세</th>
   <th scope="col">상태</th>
   <th scope="col">비고</th>
  </tr>
  <tr>
   <td>{{SpecName('HTML WHATWG','webappapis.html#handler-onchange','onchange')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

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

<p>{{Compat("api.GlobalEventHandlers.onchange")}}</p>

<h2 id="같이_보기">같이 보기</h2>

<ul>
 <li>{{event("change")}} 이벤트</li>
</ul>