aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/htmlelement/input_event/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ko/web/api/htmlelement/input_event/index.html')
-rw-r--r--files/ko/web/api/htmlelement/input_event/index.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/files/ko/web/api/htmlelement/input_event/index.html b/files/ko/web/api/htmlelement/input_event/index.html
new file mode 100644
index 0000000000..d8f606a439
--- /dev/null
+++ b/files/ko/web/api/htmlelement/input_event/index.html
@@ -0,0 +1,100 @@
+---
+title: 'HTMLElement: input event'
+slug: Web/API/HTMLElement/input_event
+translation_of: Web/API/HTMLElement/input_event
+---
+<div>{{APIRef}}</div>
+
+<p><strong><code>input</code></strong> 이벤트는 {{HTMLElement("input")}}, {{HTMLElement("select")}} 및 {{HTMLElement("textarea")}} 요소의 <code>value</code> 속성이 바뀔 때마다 발생한다.</p>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">전파 가능</th>
+ <td>가능</td>
+ </tr>
+ <tr>
+ <th scope="row">취소 가능</th>
+ <td>불가</td>
+ </tr>
+ <tr>
+ <th scope="row">인터페이스</th>
+ <td>{{DOMxRef("InputEvent")}}</td>
+ </tr>
+ <tr>
+ <th scope="row">이벤트 핸들러 속성</th>
+ <td>{{domxref("GlobalEventHandlers.oninput")}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>또한, 이 이벤트는 아무 요소의 {{domxref("HTMLElement.contentEditable", "contenteditable")}} 속성 및 {{domxref("Document.designMode", "designMode")}} 속성이 활성화 되어도 발생할 수 있다. 이런 경우, <code>contenteditable</code> 및 <code>designMode</code>, 속성이 활성화된 자식을 가진 편집 불가능한 최초 부모 요소에서 발생한다. 예를 들어 특정 요소에서 부모자식관계 중 자식 관계 여러개가 해당 속성이 활성화되어 내용 변경 시 이벤트가 발생해야 할 때, 해당 속성이 활성화되지 않은 최초의 부모 요소를 기준으로 발생하게 된다.</p>
+
+<p><code>type=checkbox</code> 및 <code>type=radio</code>, 속성을 가진 <code>&lt;input&gt;</code> 요소의 경우, <a href="https://html.spec.whatwg.org/multipage/input.html#the-input-element:event-input-2">HTML5 규격</a>에 의하면, <code>input</code> 이벤트는 반드시 사용자가 작동시킬 때마다 발생된다. 하지만 애초부터 그렇게 설계되어 있지 않은 경우가 있으므로, 반드시 아래 호환성 문단을 참고하거나, 호환되지 않을 경우, {{domxref("HTMLElement/change_event", "change")}} 이벤트를 대신해서 사용하도록 한다.</p>
+
+<div class="blockIndicator note">
+<p><strong>참고:</strong> The <code>input</code> 이벤트는 {{domxref("HTMLElement/change_event", "change")}} 이벤트와는 달리 <code>value</code> 속성이 바뀔 시마다 반드시 일어난다. 값을 선택하거나 옵션 선택하자마자 일어나지만, 특정 글자를 입력 시에는 입력이 끝나고 value 속성에 적용되어야 발생하는데, 예를 들면, 한글 입력의 경우 한글자가 완성된 뒤 다른 키를 입력(예: 엔터 키)이 일어나야 발생된다. 이 또한 브라우저마다 다르므로 호환성을 확인하여 대응해야 한다. (역자 주)</p>
+</div>
+
+<h2 id="예시">예시</h2>
+
+<p>이 예시는 {{HtmlElement("input")}} 요소에 값을 입력하자마자 로그에 기록한다.</p>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;input placeholder="Enter some text" name="name"/&gt;
+&lt;p id="values"&gt;&lt;/p&gt;</pre>
+
+<h3 id="JavaScript">JavaScript</h3>
+
+<pre class="brush: js">const input = document.querySelector('input');
+const log = document.getElementById('values');
+
+input.addEventListener('input', updateValue);
+
+function updateValue(e) {
+ log.textContent = e.target.value;
+}</pre>
+
+<h3 id="Result">Result</h3>
+
+<p>{{EmbedLiveSample("Examples")}}</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', "forms.html#event-input-input", "input event")}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM3 Events', "#event-type-input", "input event")}}</td>
+ <td>{{Spec2('DOM3 Events')}}</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.HTMLElement.input_event")}}</p>
+
+<h2 id="같이보기">같이보기</h2>
+
+<ul>
+ <li>관련 이벤트
+ <ul>
+ <li>{{domxref("HTMLElement/beforeinput_event", "beforeinput")}}</li>
+ <li>{{domxref("HTMLElement/change_event", "change")}}</li>
+ <li>{{domxref("HTMLInputElement/invalid_event", "invalid")}}</li>
+ </ul>
+ </li>
+</ul>