HTMLTextAreaElement: selectionDirection プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

selectionDirectionHTMLTextAreaElement インターフェイスのプロパティで、現在の選択の方向を示します。利用可能な値は "forward""backward""none" です。 forward の値は、現在のロケールの書字方向で選択が先頭から末尾の方向に行われたことを示し、 backward は逆方向を示します。 none の値は、方向が不明である場合に発生します。これは、 <textarea> でテキストを選択した方向を取得および変更する際に使用することができます。

selectionDirection を新しい値に設定すると、 selectchange および select イベントが発行されます。

文字列で、"forward""backward""none" のいずれかです。

js
const textarea = document.getElementById("text-box");
const end = textarea.selectionDirection;

仕様書

Specification
HTML
# dom-textarea/input-selectiondirection

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
selectionDirection

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報