I have a button in jQuery mobile:
<a href="#" data-role="button" id="show_edit" data-theme="d" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" class="ui-btn ui-corner-left ui-btn-up-a ui-btn-up-d"><span class="ui-btn-inner ui-corner-left"><span class="ui-btn-text">Edit</span></span></a>
If I do this in the console, it works (the button colour changes):
$('#show_edit').removeClass('ui-btn-up-d').addClass('ui-btn-up-a');
However, if I do wrapped in a click handler on my page, the class 'ui-btn-up-d' is not getting removed?
$('#show_edit').on('click', function() {
$(this).removeClass('ui-btn-up-d').addClass('ui-btn-up-a');
});
Edit: I think the answer below is the right one, however here is another way, which is changing the data-theme too:
$('#show_edit').attr('data-theme', 'a').attr('class', 'ui-btn ui-corner-left ui-btn-up-a');