I am creating an apache cordova application using jquery mobile. I have a login page where on successful login the page is redirected to mainpage.html by using $( ":mobile-pagecontainer" ).pagecontainer("change", "mainpage.html"); On the mainpage.html I have a multipage template using a navabar. The code is below:-
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<!-- jQuery Mobile -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
<div data-role="page" id="pageone">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
<div data-role="navbar">
<ul>
<li><a href="#" class="ui-btn-active" data-icon="home" rel="external" data-ajax="false">Home</a>
</li>
<li><a href="#pagetwo" data-icon="arrow-r" rel="external" data-ajax="false">Page Two</a>
</li>
</ul>
</div>
</div>
<div data-role="main" class="ui-content">
<p>With the ui-btn-active class, notice that the Home button stays highlighted (selected).</p>
<p>If you click on the Page Two, you will notice that none of the buttons are highlighted (selected).</p>
</div>
<div data-role="footer">
<h1>My Footer</h1>
</div>
</div>
<div data-role="page" id="pagetwo">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
<div data-role="navbar">
<ul>
<li><a href="#pageone" data-icon="home" rel="external" data-ajax="false">Home</a>
</li>
<li><a href="#" data-icon="arrow-r" rel="external" data-ajax="false">Page Two</a>
</li>
</ul>
</div>
</div>
<div data-role="main" class="ui-content">
<p>No buttons are pre-selected (highlighted) in this page..</p>
<p>To get the selected look for each button that represents the page you are actually on, go back to our navbar tutorial and read the next step to find out how!</p>
</div>
<div data-role="footer">
<h1>My Footer</h1>
</div>
</div>
The problem is that when I click the Page Two tab it does not load at the first time. On clicking it once more, it loads the div with the id page two
Can you please help me to correct the issue of not loading the page two at the first click?