I have found many solutions on the Internet, but none of them work for me. Basically, I want to switch the button icon. Here's the HTML:
<div data-role="navbar" data-iconpos="top"> <ul> <li><a data-icon="arrow-u">View suggestions</a></li> </ul> </div>
I tried all this:
$(this).buttonMarkup({ icon: 'arrow-u' });
//
$(this).attr('data-icon','arrow-u'); $(this).children().children().next().removeClass('ui-icon-arrow-d').addClass('ui-icon-arrow-u');
//
$(this).jqmData('icon','arrow-u');
However, for some reason, the children of the button disappear after any of the above actions is performed (jQuery Mobile adds a bunch of <span> inside the button).
source share