selection([start], [end])
Class: Spinner. Method inherited from TextComponent.
Description:
Selects text at specified position and length or gets current selection as an object {start:number, length:number, text:string}.
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
number |
Beginning position of text to be selected. |
|
|
number |
End position of text to be selected. If |
Returns:
If arguments are provided, this TextField component is returned; otherwise current selection is returned as object {start:number, end:number, text:string}.
Type: Object | this
Examples:
// Setting selection
textfield.selection(10, 30);
// getting selection
let s = textfield.selection();
console.log(`Selected from ${s.start} to ${s.end}: ${s.text}`);
