Page 1 of 1

Changing the button text on click

Posted: Thu Oct 03, 2013 4:53 am
by jyotsna s

There is a button in my app having text ADD TO LIST. When I click on that button, I would like to change the button text to ADDED TO LIST. Is that possible?


Changing the button text on click

Posted: Thu Oct 03, 2013 5:00 am
by Igor

Hello,

You can use next JS code on button click event
pre

Appery("mobilebutton_2").text("ADDED TO LIST");
/pre
Replace "mobilebutton_2" with your button component name.


Changing the button text on click

Posted: Thu Oct 03, 2013 6:01 am
by jyotsna s

Hey thanks Igor.. That worked perfectly. But the button size reduced. Can I change the button text alone without disturbing its size?


Changing the button text on click

Posted: Thu Oct 03, 2013 7:25 am
by Kateryna Grynko

Hi Jyotsna,

It is better to change the text on the button through the Appery.io UI. On event click add 'Set property' action. Select button in the Component name, and its property 'text' - then its size won't be changed.

If you want to this this via JavaScript, then the code would be:
code$('[name=mobilebutton_1] .ui-btn-text').text('new text');/codewhere mobilebutton_1 is a button name


Changing the button text on click

Posted: Thu Oct 03, 2013 12:14 pm
by jyotsna s

Hey thanks Katya... It worked perfectly..