Change button background
Description
The following code shows how to change button background.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.6.3.js'></script>
<script type="text/javascript"
src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css">
<style type='text/css'>
.R {<!-- ww w.j av a 2 s . co m-->
background: red;
}
.B {
background: blue;
}
.G {
background: green;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$('input[name=rdColor]').change(function() {
$(this).next().addClass($(this).val());
});
});//]]>
</script>
</head>
<body>
<div data-role="page" id="home">
<div data-role="content">
<div data-role="fieldcontain">
<fieldset data-role="controlgroup" data-type="horizontal">
<input type="radio" name="rdColor" id="rd1" value="R" />
<label for="rd1">Red</label>
<input type="radio" name="rdColor" id="rd2" value="G" />
<label for="rd2">Green</label>
<input type="radio" name="rdColor" id="rd3" value="B" />
<label for="rd3">Blue</label>
</fieldset>
</div>
</div>
</div>
</body>
</html>