Get previous Page ID
Description
The following code shows how to get previous Page ID.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.8.3.js'></script>
<script type='text/javascript'>//<![CDATA[
$(function(){<!-- w w w .ja va 2 s. c om-->
$('#second').on('pagebeforeshow', function (e, data) {
alert(data.prevPage.find('div[data-role="content"]').attr('id'));
});
});//]]>
</script>
<link rel="stylesheet"
href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script
src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
<div data-role="header">
<h1>First page</h1>
<a data-role="button" data-theme="a" href="#second"
class="ui-btn-right">Next</a>
</div>
<div data-role="content" id="IndexContent"></div>
</div>
<div data-role="page" id="second">
<div data-role="header">
<a data-role="button" data-theme="a" href="#index">Back</a>
<h1>Second page</h1>
</div>
<div data-role="content"></div>
</div>
</body>
</html>