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/focusout_event/index.html | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 files/ja/web/api/element/focusout_event/index.html (limited to 'files/ja/web/api/element/focusout_event') diff --git a/files/ja/web/api/element/focusout_event/index.html b/files/ja/web/api/element/focusout_event/index.html new file mode 100644 index 0000000000..26364b50c0 --- /dev/null +++ b/files/ja/web/api/element/focusout_event/index.html @@ -0,0 +1,112 @@ +--- +title: 'Element: focusout イベント' +slug: Web/API/Element/focusout_event +tags: + - API + - DOM + - Element + - Event + - FocusEvent + - Reference + - focusout + - onfocusout + - イベント +translation_of: Web/API/Element/focusout_event +--- +
{{APIRef}}
+ +

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

+ +

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

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
バブリングあり
キャンセル不可
インターフェイス{{DOMxRef("FocusEvent")}}
イベントハンドラープロパティ{{domxref("GlobalEventHandlers/onfocusout", "onfocusout")}}
同期 / 非同期同期
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-focusout")}}{{Spec2("UI Events")}}Added info that this event is composed.
{{SpecName("DOM3 Events", "#event-type-focusout")}}{{Spec2("DOM3 Events")}}初回定義
+ +

ブラウザーの互換性

+ + + +

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

+ +

関連情報

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