Bug Tracker

Modify

Ticket #11726 (closed bug: invalid)

Opened 13 months ago

Last modified 13 months ago

Changing button's data-theme programatically

Reported by: Radek Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

I am changing data-theme for a button dynamically from JS.

Procedure

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

After that, I noticed the the generating <div> around the button contained both ui-btn-hover-e and ui-btn-up-e and their -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", "e").removeClass("ui-btn-hover-a").removeClass("ui-btn-up-a");

Change History

comment:1 Changed 13 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

You'd want to file a bug in the jQuery Mobile issue tracker, per the big red box here that says "ARE YOU IN THE RIGHT PLACE?" http://bugs.jquery.com

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.