jyotsna s
Posts: 0
Joined: Tue Oct 01, 2013 10:28 am

Changing the button text on click

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?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Changing the button text on click

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.

jyotsna s
Posts: 0
Joined: Tue Oct 01, 2013 10:28 am

Changing the button text on click

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Changing the button text on click

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

jyotsna s
Posts: 0
Joined: Tue Oct 01, 2013 10:28 am

Changing the button text on click

Hey thanks Katya... It worked perfectly..

Return to “Issues”