HTMLTextAreaElement: selectionDirection property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
TheselectionDirection property of theHTMLTextAreaElement interface specifies the current direction of the selection. The possible values are"forward","backward", and"none". Theforward value indicates the selection was performed in the start-to-end direction of the current locale, withbackward indicating the opposite direction. Thenone value occurs if the direction is unknown. It can be used to both retrieve and change the direction of the<textarea>s selected text.
Setting theselectionDirection to a new value fires theselectionchange andselect events.
In this article
Value
A string;"forward","backward", or"none".
Examples
js
const textarea = document.getElementById("text-box");const end = textarea.selectionDirection;Specifications
| Specification |
|---|
| HTML> # dom-textarea/input-selectiondirection> |