1

On this topic: Change button text jquery mobile

http://stackoverflow.com/questions/4009524/change-button-text-jquery-mobile/11851231#11851231

Nick Craver wrote:

<a data-role="button" href="#" onclick="Podcast.consumed(); return false" id="consumed">
  <span class="ui-btn-inner ui-btn-corner-all">
    <span class="ui-btn-text">Mark Old</span>
  </span>
</a>​

and

$("#consumed .ui-btn-text").text("Mark New");

In Nick's solution the text Mark New is fixed. So, instead of having a fixed text "Mark New", the new text is from a variable? For example var newtext = "hello world"

What would the code then look like so that the text is truly variable? Meaning any dynamic text can be put on a button.

Timo11
  • 21
  • 6
  • If you're asking how to make the text truly dynamic, where you would update the `var` at any time and that would update `button` text, you are not truly understanding how JS works. – bvulaj Aug 07 '12 at 20:39
  • Brandon, not to get into details to much, but I am updating/refreshing the page every 200ms. In my case 200msec is fast enough. – Timo11 Aug 07 '12 at 20:57

1 Answers1

2

Like this:

var newtext = 'something';
$("#consumed .ui-btn-text").text(newtext);
Pablo Santa Cruz
  • 176,835
  • 32
  • 241
  • 292