Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquerymobile dynamically changing text for button issue

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/

like image 892
Yang Avatar asked Apr 10 '12 19:04

Yang


1 Answers

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.

like image 97
scottheckel Avatar answered Nov 03 '22 01:11

scottheckel