I want to change a jquery-mobile buttons color swatch dynamically with javascript, but I can\'t\' find a way (except removing and adding all classes and event handlers, but
What worked for me is:
//set button active
$(this).parent().addClass('ui-btn-active');
//set button inactive
$(this).parent().removeClass('ui-btn-active');
Adding the class 'ui-btn-active' to the parent will set the current button to active and change the data-theme to 'b'. This will not work for any arbitrary swatch though. So you may still need one of the longer solutions mentioned earlier.