8

I'm trying to dynamically change the text of the button. But the UI of button will mess up. Any idea why? http://jsfiddle.net/L6xRZ/

Chris Laplante
  • 29,338
  • 17
  • 103
  • 134
Yang
  • 6,682
  • 20
  • 64
  • 96

1 Answers1

15

jQuery Mobile goes in and changes your HTML to get everything to work as it expects. As such when you are changing the time inside of your button you are undoing what jQuery Mobile stuck in for you.

The easiest possible change you could make would be to change your selector from "#svbutton" to the following line when you go and update the button text (fiddler here):

$('#svbutton .ui-btn-text').text(currentTimeString);

You should read up more on how jQuery Mobile works and how to use it dynamically on their documentation page on Page Scripting.

scottheckel
  • 9,106
  • 1
  • 35
  • 47