aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/htmlelement/input_event
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/htmlelement/input_event
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/ja/web/api/htmlelement/input_event')
-rw-r--r--files/ja/web/api/htmlelement/input_event/index.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/files/ja/web/api/htmlelement/input_event/index.html b/files/ja/web/api/htmlelement/input_event/index.html
new file mode 100644
index 0000000000..5b8c2f71cf
--- /dev/null
+++ b/files/ja/web/api/htmlelement/input_event/index.html
@@ -0,0 +1,100 @@
+---
+title: 'HTMLElement: input イベント'
+slug: Web/API/HTMLElement/input_event
+translation_of: Web/API/HTMLElement/input_event
+---
+<p>{{APIRef}}</p>
+
+<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> の場合、イベントのターゲットは<em>編集ホスト</em>です。これらのプロパティが複数の要素に適用された場合、編集ホストは親が編集可能ではない直近の祖先要素になります。</p>
+
+<p><code>&lt;input&gt;</code> 要素が <code>type=checkbox</code> または <code>type=radio</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> <code>input</code> イベントは、要素の <code>value</code> の値が変化するたびに発生します。これは、 {{domxref("HTMLElement/change_event", "change")}} イベントが Enter キーが押されたり、選択肢から値が選択されたりするような、値が決定したときに発生するのとは異なります。</p>
+</div>
+
+<h2 id="Examples" name="Examples">例</h2>
+
+<p>この例では、 {{HtmlElement("input")}} 要素の値が変化するたびに値をログ出力します。</p>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html notranslate">&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 notranslate">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" name="Result">結果</h3>
+
+<p>{{EmbedLiveSample("Examples")}}</p>
+
+<h2 id="Specifications" name="Specifications">仕様書</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">仕様書</th>
+ <th scope="col">状態</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" name="Browser_compatibility">ブラウザーの互換性</h2>
+
+<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>
+
+<p>{{Compat("api.HTMLElement.input_event")}}</p>
+
+<h2 id="See_also" name="See_also">関連情報</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>