# Set text colour

**URL:** <https://forum.kirupa.com/t/set-text-colour/298357>\
**Category:** flash\
**Created:** [October 17, 2009, 5:57am UTC](https://forum.kirupa.com/t/set-text-colour/298357 "2009-10-17T05:57:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![holliebelle](https://avatars.discourse-cdn.com/v4/letter/h/df705f/32.png) [@holliebelle](https://forum.kirupa.com/u/holliebelle)\
**Post date:** [October 17, 2009, 5:57am UTC](https://forum.kirupa.com/t/set-text-colour/298357/1 "2009-10-17T05:57:47Z")

</div>

I have a input text field and I want the colour to change when it is clicked.

I tried:

```auto
targetTxt.onSetFocus = function() {
    if (target1 !== "") {
        target1 = "";
    }
targetTxt.setStyle("color","0xff0000");
    
};

```

and

```auto

targetTxt.onSetFocus = function() {
    if (target1 !== "") {
        target1 = "";
    }
targetTxt.setStyle(color,0xff0000);

```

};

but neither work.  
Any ideas please?
