Set active button with ui-btn-active
Description
The following code shows how to set active button with ui-btn-active.
Example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script
src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
</head><!-- w ww . j av a2s . co m-->
<body>
<div data-role="page">
<div data-role="content">
<ul data-role="listview">
<li><a class="ui-btn-active" href="#">Click</a></li>
<li><a href="#">Me</a></li>
<li><a href="#">OR</a></li>
<li><a href="#">Me</a></li>
</ul>
</div>
</div>
<script type='text/javascript'>//<![CDATA[
$('ul').find('a').on('click', function () {
$(this).closest('ul').find('a').removeClass('ui-btn-active');
$(this).addClass('ui-btn-active');
});
</script>
</body>
</html>