Changing Themes
Jump to navigation
Jump to search
You can dynamically change the theme of a JQuery Mobile control at runtime. This example shows changing the theme of a control called List1 from a to c upon a button click:
Function Button2_onclick()
$("#List1, #List1 *").each(changeTheme)
End Function
Function changeTheme(index)
$(this).data("theme", "c")
classList = $(this).attr("class") Or ""
classList = classList.split(" ")
For i = 0 To classList.length - 1
If classList[i].slice(0, 3) = "ui-" And classList[i].slice(-2) = "-a" Then
$(this).removeClass(classList[i])
$(this).addClass(classList[i].slice(0, -2) & "-c")
End If
Next
End Function