How do I read and change an Ionic button text?

This forum contains topics that were moved from Get Satisfaction
RP
Posts: 0
Joined: Thu Aug 22, 2019 9:17 pm

How do I read and change an Ionic button text?

Post by RP »

Hello,

On click of a button, I like to read the button's current text, and depending on an action change that button's text. I found this in some appery.io docs, but haven't been able to successfully use it:

//to read the button text
$('[dsid=button]').text();

//to change the button text without messing up formatting
$('[dsid=button]').find('.ui-btn-inner').text('New value');

I assume the id is the component name.

thx,
RP

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

How do I read and change an Ionic button text?

Post by Serhii Kulibaba »

Hello,

These code examples work only for JQM apps.

Please set the text property of your button = {{myText}}
Now you can change a text label of that button, by setting the value of the scope variable "myText", like: pre$scope.myText = "Hello World!";/pre

Post Reply