Skip to content

Commit e970f07

Browse files
authored
Update selectionend description to clarify that selectionEnd is the index immediately following the selection (#41802)
Update selectionend description
1 parent e66301d commit e970f07

File tree

1 file changed

+1
-1
lines changed
  • files/en-us/web/api/htmlinputelement/selectionend

1 file changed

+1
-1
lines changed

files/en-us/web/api/htmlinputelement/selectionend/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ browser-compat: api.HTMLInputElement.selectionEnd
88

99
{{ApiRef("HTML DOM")}}
1010

11-
The **`selectionEnd`** property of the {{domxref("HTMLInputElement")}} interface is a number that represents the end index of the selected text. When there is no selection, this returns the offset of the character immediately following the current text input cursor position.
11+
The **`selectionEnd`** property of the {{domxref("HTMLInputElement")}} interface is a number that represents the end index of the selected text. That is, it represents the index of the character **immediately following** the selection. Likewise, when there is no selection, this returns the offset of the character immediately following the current text input cursor position.
1212

1313
> [!NOTE]
1414
> According to the [WHATWG forms spec](https://html.spec.whatwg.org/multipage/forms.html#concept-input-apply) `selectionEnd` property applies only to inputs of types text, search, URL, tel, and password. In modern browsers, throws an exception while setting `selectionEnd` property on the rest of input types. Additionally, this property returns `null` while accessing `selectionEnd` property on non-text input elements.

0 commit comments

Comments
 (0)