Add a Variable to existing text

I would like to address my user by name, but I am having difficulty with the code. I asked for their first name on the page with a User-Input button, and I would like to address them by their first name on the same page from that point forward, but it wouldn’t be standalone, it would be inserted into an existing text field on the page.
Similar to TypeForm, when they ask you in one question, “What is your first name?” and when you answer, you see in Question 2, they say, “Hi, Liz! What is your last name?” Basically I need my page to perform a similar insert of variable information. Could anyone point me in the right direction of an article or documentation that would direct me in how to word the code so I can do this?

(I have successfully inserted text into existing text fields with code on other pages. It is only the addition of the variable that is stumping me.)

Hi,

You can use Javascript Template Literals to achieve this. You mentioned that you’ve asked for the users name, so I’m assuming you already saved it in a variable. If that’s so, you can use a simple text component the following way:

$w('#text1').text = `Hi ${username}, how are you today?`

Where ‘text1’ is the id of the text component, and ‘username’ is the variable that holds the users first name.

Hope this helps,
Liran.

Thank you!! I will try that!!