user2272841
user2272841

Reputation: 21

How I change the button color after clicking on itself?

I have created 3 themes on http://jquerymobile.com/themeroller/. Each theme has a different button color. I tried to change the following button theme from data theme a to data theme c:

<button data-icon="star" data-theme="a" data-form="ui-btn-up-a" id="btnA" class="ui-btn-hidden" data-disabled="false">0,2 m3</button>

using this function:

$("#btnA").click(function()
{
    $("#btnA").buttonMarkup({theme: 'c'});
});

but the color of btnA doesn't change. How do I proceed?

Upvotes: 2

Views: 805

Answers (1)

Subedi Kishor
Subedi Kishor

Reputation: 5996

Once you have set set the theme on the button you'll need to call refresh on it like below...

$("#btnA").click(function() {
    $(this).attr("data-theme","c").button('refresh');
});

Enjoy...

Upvotes: 1

Related Questions