RP
Posts: 0
Joined: Thu Aug 22, 2019 9:17 pm

How do I read and change an Ionic button text?

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: 150
Joined: Tue Aug 27, 2013 1:47 pm

How do I read and change an Ionic button text?

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

Return to “Issues”