Search code examples
jqueryhtmljquery-mobilemarkupjquery-mobile-button

Jquery mobile - update button style


If you add items to a listview, you'll need to call the refresh() method on it to update the styles and create any nested lists that are added. For example:

$('#mylist').listview('refresh');

What code I need if I add buttons to the page and refresh the style.


Solution

  • This one:

    $('buttonID').button();
    

    Working example: http://jsfiddle.net/Gajotres/m4rjZ/

    There's also another function called buttonMarkup(), it is used to change some already styled button properties, for example to change button icon:

    $('buttonID').buttonMarkup({ icon: "star" });
    

    Read more about it in my other article: jQuery Mobile: Markup Enhancement of dynamically added content

    And a link to an official documentation.