change jquery mobile color swatch dynamically

2020-02-10 17:50发布

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 that's to messy).
Whats the best way to do that?

7条回答
迷人小祖宗
2楼-- · 2020-02-10 18:41

If the button is defined as:

<button type="button" id="yourbutton">Hello</button>

Then this works the fastest:

$('#yourbutton').parent().find('.ui-btn-inner').css("background-color",yournewcolor);
查看更多
登录 后发表回答