Baseline Widely available
The selectionDirection
property of the HTMLTextAreaElement
interface specifies the current direction of the selection. The possible values are "forward"
, "backward"
, and "none"
. The forward
value indicates the selection was performed in the start-to-end direction of the current locale, with backward
indicating the opposite direction. The none
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 the selectionDirection
to a new value fires the selectchange
and select
events.
A string; "forward"
, "backward"
, or "none"
.
const textarea = document.getElementById("text-box");
const end = textarea.selectionDirection;
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4