Alex Rivera | Logout

Jquery mobile: Change theme on click

Asked 2011-11-01T19:58:31.020
11

I have got a basic list with the theme a. I am trying to find a way to change the theme when clicking on a button. Have tried $('a li').attr('data-theme','a'); combined with list refresh with no luck. An success out there?

Edit
Report

2 Answers

1

I noticed that if you change the "data-theme" attribute, jQuery Mobile would refresh your theme on the mouseover event. This solution is kind of a hack, but it's simple.

$("a li").attr("data-theme", "a").trigger("mouseout")

Sorry for resurrecting a dead question, but I found this question Google (#6 on the SERP for "jquery mobile change theme") and there was no correct answer.

answered 2011-11-15T16:54:50.703
1

This worked for me.

$("a li").removeClass("ui-body-b"); //remove old theme
$("a li").addClass("ui-body-a"); //add new theme
answered 2012-05-20T16:59:40.177

Your Answer