Skip to main content
Participating Frequently
Oct 2, 2025 3:26 PM UTC
Answered

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

 

    JoãoCésar17023019
    JoãoCésar17023019Correct answer
    Community Expert
    Oct 2, 2025 3:47 PM UTC

    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
    Oct 2, 2025 3:47 PM UTC

    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
    Oct 2, 2025 10:19 PM UTC

    It worked, thanks so much.

    Translate
    JoãoCésar17023019
    Community Expert
    Community Expert
    Oct 2, 2025 11:19 PM UTC

    You're welcome.

    Translate
    kglad
    Community Expert
    Community Expert
    Oct 2, 2025 3:31 PM UTC

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

    Translate