I've this code to change a color of a button on click:
$('.fav').live('click', function(e) {
$(this).buttonMarkup({ theme: "b" });
});
How can I return to normal color (theme c) by clicking the button again?
Is there any way to see the state of a button?
As it has to be live then you could just make your own toggle:
$('.fav').live('click', function() {
var dotoggle = $(this).attr("dotoggle");
if ( dotoggle == "1" ) {
$(this).buttonMarkup({ theme: "c" });
$(this).attr("dotoggle","0");
}
else {
$(this).buttonMarkup({ theme: "b" });
$(this).attr("dotoggle","1");
}
});
JSFiddle of a custom toggle example: http://jsfiddle.net/PLx8v/3/