selectionStart
selectionStart is a numeric property of text input and textarea elements in the HTML DOM. It indicates the position, in characters, of the start of the current text selection within the element’s value, counted from 0 at the beginning.
If there is no selection, the value of selectionStart corresponds to the caret’s position. The property is
Scope and compatibility: selectionStart applies to input elements of type text and related text inputs as well
Example: var start = input.selectionStart; var end = input.selectionEnd; input.setSelectionRange(5, 10);