I\'ve a big problem with a jQuery Mobile Application: I\'m using custom functions (they are triggered by onClick) to switch the page with currentPage.
It only happen
I encountered exactly the same behaviour and it seems that few people are having the same issue. At first I thought it is caused by jQuery mobile library. Later on, I manage to find where the problem came from and it is a bug in my own code. I made a demo to explain the issue.
http://jsfiddle.net/pengyanb/6zvpgd4p/10/
Hopefully, this can be hint for people having the same problem.
$(document).on('pagebeforeshow', '#page2', function(){
console.log('Page2 before show');
var htmlGeneratedOnTheFly = '';
for(var i=0; i<4; i++)
{
htmlGeneratedOnTheFly += '- Random html element
';
}
htmlGeneratedOnTheFly += '
Demo Page 1
jQuery mobile changepage jumps back to old page demo
Click "Go To Page 2" button to go to page2
On Page2 click Ok Button to come back to page1
Keeping going back forth between two pages for few times.
Eventually, you will find that clicked on "Go To Page2" button to flip to Page2 but it soon jumps back to page1 automatically.
Please read the comments in the javascript for explaination
Go To Page 2