setSelectionRange

fun setSelectionRange(start: Int?, end: Int?, direction: SelectionDirection = definedExternally)(source)

The HTMLInputElement.setSelectionRange() method sets the start and end positions of the current text selection in an input or textarea element.

MDN Reference