What I want to do is, to create a button and this button is pressed, it will change the theme color on my jQuery mobile test site.
So say that my html parent div looks like this
<div id="firstPage" data-role="page">
I want it so that on click, that it appends data-theme="theme letter here"
to the div so that it ends up like this <div id="firstPage" data-role="page" data-theme="theme letter here">
OR
If I start the div like this <div id="firstPage" data-role="page" data-theme="theme letter here">
That on the buttons click, that it changes that data-theme attribute to another letter
so something for example, like this
$('#themeBtn').click(function(){
$('#firstPage').setAttribute("data-role","ANOTHER theme letter");
});
or
$('#themeBtn').click(function(){
$('#firstPage').append("data-role","a");
});
or something like this. How can I properly go about this?
Thanks in advanced.
EDIT* based on the responses, ive tried**
/////////////TESTING THEME BUTTON (check STACK OVERFLOW for answer)
$('#themeBtn').click(function(){
//$('#firstPage').jqmData("role","a");
//$('#firstPage').attr("data-theme","a");
//$('#firstPage').jqmData("theme","a");
$('#firstPage').data('theme','a');
});
To make sure that the button is firing off, i commented all those lines out and did a simple
$('#themeBtn').click(function(){
alert("foo");
});
and sure enough it fired the alert on button click so im positive its working.(the button i mean).
I added a jsFiddle so you can see it in action(of not working lol) http://jsfiddle.net/somdow/yRmKd/1/ if you un-comment the alert, itll fire off, when you uncomment the other lines(based on responses) it doesn't update.