Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextField() Set caret position

How to set the caret position, there is only

this.caretIndex (READ)

like image 937
Tom Avatar asked Feb 11 '09 14:02

Tom


People also ask

How do you set a caret position?

The first expected parameter is the ID of the element you wish to insert the keyboard caret on. If the element is unable to be found, nothing will happen (obviously). The second parameter is the caret positon index. Zero will put the keyboard caret at the beginning.

How do I get the cursor position in HTML?

If you ever had a specific case where you had to retrieve the position of a caret (your cursor's position) inside an HTML input field, you can do so using the selectionStart property of an input's value.

How do you change the input cursor position?

To move the cursor to the end of an input field: Use the setSelectionRange() method to set the current text selection position to the end of the input field. Call the focus() method on the input element. The focus method will move the cursor to the end of the input element's value.


1 Answers

use setSelection(beginIndex:int, endIndex:int):void

eg

this.textField.setSelection(20, 20)
like image 153
James Hay Avatar answered Sep 20 '22 08:09

James Hay