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.
selectionDirection
は HTMLTextAreaElement
インターフェイスのプロパティで、現在の選択の方向を示します。利用可能な値は "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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
selectionDirection |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.