Dynamically update <text> value

Dynamically update <text> value

Hi. Im hoping someone can help with this.

Say for example I have a <text> in a zml snippet in a Creator page. How can I change the value of this text when a button is clicked?

For example, I have button 1 ,button 2 and button 3. If user clicked the button 1, the value of the <text> will be updated  to "This is button 1". And if button 2 is clicked, value of <text> will be "This is button 2".

How can I achieve this usung custom function? To dynamically change the value of the <text>