Change button icon after clicking
Description
The following code shows how to change button icon after clicking.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.7.1.js'></script>
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.css">
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!-- w w w . ja v a 2 s . c o m-->
$("#btnFree").live("click tap", function() {
$("#btnFree").children('span.ui-btn-inner').children('span.ui-icon').removeClass('ui-icon-alert');
$("#btnFree").children('span.ui-btn-inner').children('span.ui-icon').addClass('ui-icon-check');
$("#btnFree").removeClass('ui-btn-active');
});
});//]]>
</script>
</head>
<body>
<div data-role="page">
<div data-role="navbar" id="nvb1">
<ul>
<li><a href='#' data-role="button" id="btnFree"
data-iconpos="top" data-icon="alert">Free</a></li>
<li><a href='#' data-role="button" id="btnBusy"
data-iconpos="top" onClick="setStatus('busy')">Busy</a></li>
</ul>
</div>
</div>
</body>
</html>