Page 1 of 1

How do I read and change an Ionic button text?

Posted: Mon Sep 16, 2019 8:02 pm
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


How do I read and change an Ionic button text?

Posted: Mon Sep 16, 2019 8:32 pm
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