Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Changing button's data-theme programatically #4317

Closed
@rskokan

Description

@rskokan

Changing the data-theme attr. for buttons dynamically from JS seems to have some issues in version 1.1.0:

Procedure

  1. I have a button with theme "e"
  2. I change it to "a" via $btn.attr("data-theme", "a")
  3. The button is still displayed in yellow, with the previous "e" theme

After that, I noticed the the generated div around the button contained both ui-btn-hover-e & ui-btn-up-e and also their (correct) -a variants.
It is also in case when I'm updating data-theme for the div.

So the workaround for me is to also remove the previous classes from the generated div:

$btn.closest("div").attr("data-theme", "a").removeClass("ui-btn-hover-e").removeClass("ui-btn-up-e");

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions