Recently in a project, using jquery Mobile, very unfamiliar to him, the problem of one after another, it is necessary to solve, find a day this problem, put can understand:
First understand JQM inside page jump by default is through the AJAX request, must re-refresh the page JS square can be effective, that is, JS does not work, not JS itself problem, the following talk about the solution:
In web Development using jQuery Mobile , when the page jumps (PageA = PageB), the JS referenced in PageB does not run successfully. Because, JQM and loading the entire page into the current DOM, only the data-role= "page" element is added to the current DOM.
Therefore, the introduction of the external JS file in new page can be loaded successfully.
Given that the JQM feature is unlikely to be actively changed, it can be solved in two ways :
First, in the index page, register all the external JS files that need to use, or use the master page to unify;
Second, the page internal JS written in the data-role= "page" tag, so no matter how the page jumps, can be run.