# Setting caret (flashing cursor) when focus on text field

**URL:** <https://forum.kirupa.com/t/setting-caret-flashing-cursor-when-focus-on-text-field/287649>\
**Category:** Uncategorized\
**Created:** [May 4, 2009, 6:26pm UTC](https://forum.kirupa.com/t/setting-caret-flashing-cursor-when-focus-on-text-field/287649 "2009-05-04T18:26:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaedo](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Shaedo](https://forum.kirupa.com/u/Shaedo)\
**Post date:** [May 4, 2009, 6:26pm UTC](https://forum.kirupa.com/t/setting-caret-flashing-cursor-when-focus-on-text-field/287649/1 "2009-05-04T18:26:01Z")

</div>

Hi all,

I want to have the caret (flashing cursor) to appear when I set the focus to a text field.  
It works fine when the user clicks on the text field.

the following does not seem to work for me:

```auto
 
stage.focus = mytxtfield
mytxtfield.setSelection(mytxtfield.text.length,mytxtfield.text.length);

```

When I try this it merely focuses on my text field and no caret comes up!  
_mytxtfield_ is the instance name of my input type textfield.

Thank you for taking the time to look at my problem.
