Skip to main content
Participating Frequently
October 2, 2025
Answered

Is It Possible to Put Placeholder text into a Text InputBox?

 

    JoãoCésar17023019
    JoãoCésar17023019Correct answer
    Community Expert
    October 2, 2025

    Hi.

     

    You can set its placeholder property as this TextInput component is a regular HTML input text under the hood. Just keep in mind that components are not immediately ready when the code in the first frame of the main timeline runs. So one of the approaches is to listen for the stage's drawend event. Like this:

    function main()
    {
        var inputTF = document.getElementById("yourInstanceName");
        inputTF.placeholder = "Something...";
    }
    
    stage.on("drawend", main, this, true);


    Regards,

    JC

    4 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    October 2, 2025

    Hi.

     

    You can set its placeholder property as this TextInput component is a regular HTML input text under the hood. Just keep in mind that components are not immediately ready when the code in the first frame of the main timeline runs. So one of the approaches is to listen for the stage's drawend event. Like this:

    function main()
    {
        var inputTF = document.getElementById("yourInstanceName");
        inputTF.placeholder = "Something...";
    }
    
    stage.on("drawend", main, this, true);


    Regards,

    JC

    Translate
    mary_0172Author
    Participating Frequently
    October 2, 2025

    It worked, thanks so much.

    Translate
    JoãoCésar17023019
    Community Expert
    Community Expert
    October 2, 2025

    You're welcome.

    Translate
    kglad
    Community Expert
    Community Expert
    October 2, 2025

    yes, just assign text property to the textfield.  you can see the correct reference by using the code hints.

    Translate