Home > Web Front-end > JS Tutorial > body text

Analysis and solutions to the reasons why external JS is not loaded after the jQuery Mobile page jumps_jquery

WBOY
Release: 2016-05-16 17:40:11
Original
975 people have browsed it

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.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!