External JS not loaded after jQuery Mobile page jump

In web development with 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, only the data-role="page" element is added to the current dom. Therefore, the external JS files introduced in <head> and the JS outside the <page> tag cannot run normally, and can be loaded successfully after refreshing the page.
 
Given that this feature of JQM 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 be used, 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 no matter how the page jumps, it can run.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325521609&siteId=291194637