Set text colour

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

I tried:

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

and


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

};

but neither work.
Any ideas please?