Toggle button class
Description
The following code shows how to toggle button class.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css"
href="http://jquerymobile.com/demos/1.2.0/css/themes/default/jquery.mobile-1.2.0.css">
<script type='text/javascript'
src="http://jquerymobile.com/demos/1.2.0/js/jquery.mobile-1.2.0.js"></script>
<style type='text/css'>
.someRedStuff {<!-- ww w. ja v a 2 s. c o m-->
background: red !important;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$('#custom-li-3').on('click', function(event){
$(this).toggleClass('someRedStuff');
});
});//]]>
</script>
</head>
<body>
<div data-role="page" class="type-home">
<div data-role="content">
<a data-role="button" data-iconpos="notext" data-icon="star"
id="custom-li-3"></a>
</div>
</div>
</body>
</html>