In web development using jQuery Mobile, when the page jumps (pageA => pageB), the JS referenced in pageB does not run successfully. Because, JQM does not load the entire page into the current dom, but only adds the data-role="page" element to the current dom.
Therefore, the external JS files introduced in
and the JS outside the
tag cannot run normally, and they can be loaded successfully after refreshing the page.
Since this feature of JQM is unlikely to be actively changed, there are two ways to solve it :
First, register all external JS files that need to be used in the index page. Or use the master page to unify;
The second is to write the internal JS of the page under the data-role="page" tag, so that it can run no matter how the page jumps.