From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/element/focusin_event/index.html | 111 ++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 files/ja/web/api/element/focusin_event/index.html (limited to 'files/ja/web/api/element/focusin_event') diff --git a/files/ja/web/api/element/focusin_event/index.html b/files/ja/web/api/element/focusin_event/index.html new file mode 100644 index 0000000000..cd6d134821 --- /dev/null +++ b/files/ja/web/api/element/focusin_event/index.html @@ -0,0 +1,111 @@ +--- +title: 'Element: focusin イベント' +slug: Web/API/Element/focusin_event +tags: + - API + - DOM + - Element + - Event + - FocusEvent + - Reference + - focusin + - イベント +translation_of: Web/API/Element/focusin_event +--- +
{{APIRef}}
+ +

focusin イベントは、要素がフォーカスを受け取ろうとしているときに発生します。このイベントと {{domxref("Element/focus_event", "focus")}} との主な違いは、 focusin がバブリングを行うのに対し focus は行わないことです。

+ +

focusin の反対は {{domxref("Element/focusout_event", "focusout")}} です。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
バブリングあり
キャンセル可能いいえ
インターフェイス{{DOMxRef("FocusEvent")}}
イベントハンドラープロパティ{{domxref("GlobalEventHandlers/onfocusin", "onfocusin")}}
同期 / 非同期同期
Composedはい
+ +

+ +

ライブデモ

+ +

HTML

+ +
<form id="form">
+  <input type="text" placeholder="text input">
+  <input type="password" placeholder="password">
+</form>
+ +

JavaScript

+ +
const form = document.getElementById('form');
+
+form.addEventListener('focusin', (event) => {
+  event.target.style.background = 'pink';
+});
+
+form.addEventListener('focusout', (event) => {
+  event.target.style.background = '';
+});
+ +

結果

+ +

{{EmbedLiveSample("Live_example", '100%', '50px')}}

+ +

仕様書

+ + + + + + + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName("UI Events", "#event-type-focusin")}}{{Spec2("UI Events")}}Added info that this event is composed.
{{SpecName("DOM3 Events", "#event-type-focusin")}}{{Spec2("DOM3 Events")}}初回定義
+ +

ブラウザーの対応

+ + + +

{{Compat("api.Element.focusin_event")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf