JSFiddle - React, Tailwind, and code Playground
by Omar X
HTML
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css">
<script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>
<div data-role="page" id="foo">
<div data-role="header">
<h1 class="ui-title">Page 1 - foo container</h1>
</div>
<div class="ui-content">
<p>content</p> <a href="#bar" class="ui-btn diff">Go to Page 2</a>
</div>
</div>
<div data-role="page" id="bar">
<div data-role="header">
<h1 class="ui-title">Page 2</h1>
</div>
<div class="ui-content">
<p>content</p>
</div>
</div>
JavaScript
$(document).on("pagecontainerbeforeshow", function (e, ui) {
alert("Current page's ID " + $.mobile.pageContainer.pagecontainer("getActivePage")[0].id);
});